The most complete Pycharm tutorial (7)--Configuration of virtual machine VM

Source: Internet
Author: User

Pycharm Tutorial (1)--Customizing the appearance

Most full Pycharm Tutorials (2)--code style

The most complete Pycharm tutorial (3)--code debugging, running

The most complete pycharm tutorial (4)--related configuration of the Python interpreter

Most full Pycharm tutorial (5)--python shortcut key Related settings

The most complete Pycharm tutorial (6)--use Pycharm as the VIM editor

The most complete pycharm tutorial (8) The creation and management of--django project

Imagine a situation where you operate your project on a platform, but you want to refine and run it on another platform, which is why Pycharm does a lot of work to support remote debugging.

Running a project on a virtual machine consists of the following steps:

(1) Define a virtual frame define a dummy box

(2) The need to configure a remote interpreter under the virtual framework configure a Sqlremote interpreter

(3) Loading the current project at the remote console launch your script in the Sqlremote console

1. Preparation work

Make sure your pycharm already has the following environments:

(1) Installation of Oracle ' s Virtual Box

(2) installed the vagrant

(3) Add the executable files to the environment variable

Vagrant the Vagrant.bat file under the installation file, this part of the work should be automatically completed by the Setup program

Oracle ' s VirtualBox VBoxManage.exe files under the installation files.

Make sure that the Pycharm vagrant Plug-in is available: Click the Settings button in the main toolbar to open the Plugins page in the Settings dialog box, showing that the plugin is available by default:

The preparations have been completed and officially begun.

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 predefined, the selected item appears in a Drop-down list from which you can select one:

If you do not currently have the appropriate virtual box, you can add one by clicking the green plus sign, entering the frame name and the download address:

Click Ok,pycharm to start downloading the VM templates automatically:

So you've created a new virtual box and added it to the 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. Click Tools on the main menu | Vagrant, Select Init in Project Root:

Select the Vagrant box you intend to initialize:

The corresponding Vagrantfile file is created and can be changed as required:

After initialization completes, execute the Vagrant up command (select the UP command in the vagrant menu):

Pycharm automatically runs the vagrant up command and displays 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) and select the Project interpreter page where you can select a corresponding interpreter from the Drop-down list, but if there is no interpreter available now, we need to click Configure Interpreters comes from defining a:

The Python interpreters interface opens, and the green plus sign is clicked to select a remote interpreter:

In the Configure Remote Python Interpreter dialog box, a server configuration is required. These settings can be set manually, or you can import them from the Vagrant configuration file that you have defined, where we choose the second way. Click the Fill from Vagrant Configuration button to automatically populate the related Settings property values based on the contents of the configuration file:

To confirm that the configuration was successful, click Test Connection ... Button:

Set it as the default interpreter:

From now on, we can run all the scripting projects on VM virtual machines:

Next we login to Virtual box via SSH.

4, Link SSH terminal

Why do I need to log in? Because Pycharm asked you to do that.

Select Tools in the main menu | Run SSH Terminal, if you define more than one host (host), select a link you want to create (we choose the Remote interpreter here):


Watch the console run information for the Run tool window:

Now that you have been able to interact directly with virtual box, let's first make sure that your engineering directory is fully mapped. Just observe the default shared folder information for vagrant ' s:

Next, run a script file that is available, such as solver.py:

Done.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.