Pycharm tutorial (4) Python interpreter configuration, pycharmpython

Source: Internet
Author: User
Tags ssh server virtual environment

Pycharm tutorial (4) Python interpreter configuration, pycharmpython

The configuration of the Python interpreter is for your reference. The specific content is as follows:

1. Preparations

(1) The Pycharm version is 3.4 or later.

(2) At least one Python interpreter has been installed on the computer.

(3) If you want to configure a remote interpreter, you need support from the server.

2. Local interpreter Configuration

The steps for configuring the local interpreter are relatively simple and intuitive:

(1) Click the Settings button in the toolbar.

(2) In the Settings/Preferences dialog box, select the Project Interpreter page, select the corresponding Interpreter version from the drop-down list corresponding to the Project Interpreter, or click the setting button on the right to manually add the Interpreter.

(3) In the next case, select the Add Local option and select the expected interpreter (the executable file of Python ).

It is worth mentioning that some pre-defined virtual environments can also be added as interpreters.

3. Remote interpreter Configuration

When configuring the remote interpreter, use the setup Method Based on the SSH connection (ensure that the server has provided remote support for response ).

4. Configure the remote interpreter through existing deployment settings

First, we need a server. You can use Tools | Deployment in the main menu, and then click Configuration to define:

Next, click the green plus sign in the Deployment dialog box to create a server, enter a name, select the corresponding type (generally SFTP), and other necessary settings (host, port, login name ). Click Test connection. Connection successful is displayed! The interpreter is successfully connected.

Next, click the Settings button in the main toolbar, open the Project Interpreter page in the Settings/Preferences dialog box, click the Settings icon, and select Add Remote:

In the Configure Remote Python Interpreter dialog box, click Deployment configuration to set an existing SSH server (for example, this one you defined earlier ).

Select the desired remote service from the list. After the selection is complete, all server settings are automatically filled.

In this case, the Remote interpreter can be used as the interpreter of the current project. Note that all Remote interpreters here add a prefix "Remote ".

5. SSH certificate-based remote Interpreter

If you have not defined the server settings in advance, you can follow these steps to manually create a specific connection:

1) Click the Settings button in the main toolbar to open the Settings/Preferences dialog box, select the Project Interpreter page, click the Settings button, and select Add Remote:

Next, in the Configure Remote Python Interpreter dialog box, select SSH credentials and enter the Host, port number, and user name of the server:

In this case, the Remote interpreter can be used as the interpreter of the current project. Note that all Remote interpreters here add a prefix "Remote ".

6. virtual box-based remote Interpreter

Another way to define the remote interpreter is through the Vagrant configuration file. Prepare some work in advance before using virtual boxes, so check the following issues before you start:

(1) The Vagrant has been correctly installed on the computer and the related infrastructure has been created.

(2) Oracle's VirtualBox has been correctly installed on the computer.

(3) ensure that the following two Executable File paths are added to the system environment variables:

The Vagrant. bat file under the vagrant installation directory should be automatically completed by the installer.

The vboxmanage.exe file path under the Oracle's virtualboxinstallation directory.

Finally, make sure that the relevant plug-ins of Vagrant can be used normally.

First, you need a virtual box, which requires manual configuration. However, Pycharm provides some column auxiliary tools to complete the settings in the current IDE environment.

Click the Settings button in the main toolbar to go to the Settings/Preferences dialog box and open the Vagrant page.

Pay attention to the path of the Vagrant executable file and the path of the folder where the Vagrant instance is located:

If the virtual box has been defined, it will appear in the drop-down list to facilitate selection. If no virtual box is available, you can click the green plus sign to create a new virtual box.

Next, you need to initialize Vagrant box. On the main menu, Click Tools | Vagrant, select Init in Project Root, and selectVagrant upCommand:

Next, go to the Settings/Preferences dialog box again, open the Project Interpreter page, and select Add Remote:

In the Configure Remote Python Interpreter dialog box, customize server-related settings. These settings can be replaced by the previously defined configuration file. Therefore, select the Vagrant option.

All server settings are automatically filled as follows:

In this case, the Remote interpreter can be used as the interpreter of the current project. Note that all Remote interpreters here add a prefix "Remote ".

For more information, see dedicated Vagrant tutorial.

7. Create a virtual environment

(1) Open the Project Interpreter page (click the setting button on the toolbar ).

(2) Click the settings icon and select Create Virtual Environment.

(3) In the Create Virtual Environment dialog box, enter the name and location of the new Virtual Environment, and specify the Python interpreter on which the Virtual Environment depends:

It may take some time to create a virtual environment. Pycharm will give a progress bar to indicate the current creation process:

8. Third-party library and path Configuration

After the virtual environment is configured, you will see all the third-party Libraries currently installed. Pycharm will list the versions of each third-party library currently installed and the latest version of the response, you can decide whether to upgrade it:

To view the installation path, you can click More in the dialog box to view all available Python interpreters:

Select an interpreter and click the button on the right toolbar to view its corresponding path structure:

If an interpreter has been updated, you are advised to update its path by clicking.

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

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.