Pycharm Basic Primer Configuration Interpreter

Source: Internet
Author: User
Tags ssh server virtual environment
This article mainly for you to introduce the most comprehensive Pycharm learning tutorial fourth, Python interpreter configuration, with a certain reference value, interested in small partners can refer to

Python interpreter configuration, for your reference, the specific content is as follows

1. Preparatory work

(1) The Pycharm version is 3.4 or higher.

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

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

2. Local interpreter configuration

The steps to configure the local interpreter are relatively straightforward:

(1) Click the Settings button in the toolbar.

(2) In the Settings/preferences dialog box, select the Project interpreter page, choose the appropriate interpreter version in the drop-down list for project interpreter, or click the Settings button on the right to add it manually.

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

It is worth mentioning that for some pre-defined virtual environments, it can also be added as an interpreter.

3. Remote Interpreter Configuration

When configuring the remote interpreter, use the SSH connection-based Setup method (to ensure that the server has provided remote support for the response).

4. Configure the remote interpreter with existing deployment settings

First, we need a server that can be used through the main menu of Tools | Deployment, and then click Configuration to define one:

Next click on the green Gash in the deployment dialog to create a server, enter a name, select the corresponding type (typically SFTP), and some other necessary settings (host, port, login name, and so on). After confirming the error, click Test Connection, and the connection successful! message box pops up to indicate that the interpreter was 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 then select Add Remote:

In the Configure Remote Python Interpreter dialog box, click the Deployment Configuration button to set up an existing SSH server (such as the one you defined earlier).

Select the remote service you want in the list, and when you are finished, you will see that all server settings have been automatically populated.

At this point the remote interpreter can be used as an interpreter for the current project, note that all the remote interpreters here will be named with a prefix "remote".

5. Remote interpreter based on SSH certificate

If you do not define the server settings in advance, you can also manually establish a specific connection by following these steps:

1), click the Settings button of 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 then type the server host, port number, user name, and so on:

At this point the remote interpreter can be used as an interpreter for the current project, note that all the remote interpreters here will be named with a prefix "remote".

6. Remote interpreter based on virtual box

Another way to define a remote interpreter is by vagrant the configuration file. Before you start working with virtual boxes, make sure you have some questions before you begin:

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

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

(3) Ensure that the path to the following two executable files is added to the environment variables of the system:

Vagrant the Vagrant.bat file in the installation directory, this step should be done automatically by the Setup program.

The VBoxManage.exe file path in the Oracle's VirtualBox installation directory.

Finally, make sure that the relevant plug-ins for vagrant are working properly.

First of all, you need a virtual box, which needs to be configured manually, but Pycharm provides some of the column aids that we can do in the current IDE environment.

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

Note the path to the vagrant executable file and the folder path where the vagrant instance resides:

If virtual box is already implemented, it will appear in the drop-down list to facilitate our selection. If you don't currently have a suitable virtual box to choose from, you can create a new one by clicking the Green plus sign.

The next step is to initialize the Vagrant box. On the main menu, click Tools | Vagrant, select init in Project Root and select the Vagrant up command:

Next, go to the Settings/preferences dialog again, open the Project interpreter page and select Add Remote:

In the Configure Remote Python Interpreter dialog box, customize the settings for the server, which can be replaced by the previously defined configuration file, so check the Vagrant option.

All server settings are automatically populated as follows:

At this point the remote interpreter can be used as an interpreter for the current project, note that all the remote interpreters here will be named with a prefix "remote".

See dedicated Vagrant tutorial for more information.

7. Create a virtual environment

(1) Open the Project interpreter page (by clicking the Settings 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, along with the Python interpreter that the virtual environment relies on:

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

8. Configuration of third-party libraries and paths

Once you have configured your virtual environment, you will see all of the third-party libraries currently installed, Pycharm will list the version of each third-party library that is currently installed, and the latest version of the response, and you can decide whether to upgrade it:

In order to view the installation path, you can view all available Python interpreters by clicking the Settings button in the dialog box and selecting More, at this point:

Select an interpreter, and then click the button in the right-hand toolbar to see its corresponding path structure:

If an interpreter has been updated, it is a good idea to update its path by clicking it.

"Recommended"

1. Python Free video tutorial

2. Python Learning Manual

3. Python Object-oriented video tutorial

Related Article

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.