Most complete Pycharm Tutorials (1)--Custom Skins
Most full Pycharm Tutorials (2)-code style
Most full Pycharm Tutorials (3)-code debugging, running
Most complete Pycharm Tutorials (4)--related configuration for Python interpreter
Most full Pycharm Tutorials (5)--python shortcut key Related settings
Most full Pycharm Tutorials (6)--using Pycharm as a VIM editor
Most complete Pycharm tutorials (8) creation and management of--django engineering
Imagine a situation where you operate your project on one platform, but you want to refine and run it on a different platform, which is why Pycharm does a lot of work to support remote debugging.
Running a project on a virtual machine consists mainly of the following steps:
(1) Define a virtual frame define a Vsan
(2) A remote interpreter needs to be configured under a virtual framework configure a remotes interpreter
(3) Loading the current project launch your script in the remote console
1. Preparatory work
Make sure your pycharm already has the following environment:
(1) Oracle's Virtual Box installed
(2) Installation of vagrant
(3) Add the executable files to the environment variables
Vagrant the Vagrant.bat file under the installation file, this part of the work should be done automatically by the Setup program
The VBoxManage.exe file under the Oracle ' s VirtualBox installation file.
Make sure that the Pycharm Vagrant plugin is available: Click the Settings button in the main toolbar, open the Plugins page in the Settings dialog box, and show that the plugin is available by default:
At this point, the preparation is completed and officially begins.
2. Create a virtual box
In the Settings dialog box (click the Settings button on the main toolbar), click the Vagrant interface, and then enter the path to the executable file and the instance path.
If the frame is already pre-defined, the item will appear in a drop-down list, selecting one from it:
If you do not currently have a suitable virtual box, you can add one by clicking the green plus sign and entering the frame name and:
Click Ok,pycharm to start the automatic download of VM templates:
You have now created a new virtual box and added it to your current environment.
Note the Vagrant command under the Tool menu, which is associated with the standard Vagrant behavior.
Once the Vagrant box is created, it needs to be initialized under the project stub. On the main menu, click Tools | Vagrant, Select Init in Project Root:
Select the Vagrant box you want to initialize:
The corresponding Vagrantfile file is created and can be changed as required:
After initialization is complete, execute the Vagrant up command (select the UP command in the Vagrant menu):
Pycharm will automatically run the vagrant up command and display the output in the console interface:
3. Configure the remote interpreter on the virtual machine
Open the Settings dialog again (click the Settings button on the main toolbar), select the Project interpreter page, where you can select a corresponding interpreter from the drop-down list, but if there are no interpreters available, we need to click Configure Interpreters comes from defining one:
The Python interpreters interface opens, click the Green plus sign to select a remote interpreter:
In the Configure Remote Python Interpreter dialog box, the server configuration is required. These settings can be set manually or imported from a vagrant configuration file that has already been defined, where we choose the second way. Clicking the fill from Vagrant Configuration button will automatically populate the relevant settings property values based on the contents of the configuration file:
In order to confirm whether the configuration was successful, click Test Connection ... Button:
Set it as the default interpreter:
From now on, we can run all of the script projects on VM virtual machines:
Next we'll log in to Virtual box via SSH.
4. Link SSH terminal
Why do I need to log in? Because Pycharm asked you to do this.
Select Tools from the main menu | Run SSH Terminal, if you have defined more than one host, select the one you want to create the link (we choose the Remote interpreter here):
Observe the console run information for the Run tool window windows:
Now that you've been able to interact directly with virtual box, let's first confirm that your project catalog is fully mapped. Simply observe the vagrant's default shared folder information:
Next, run an available script file, such as solver.py:
Done.
Most full Pycharm Tutorials (7)--Configuration of VM VMs