Skip to content

[Python] Use PyCharm to connect to the Python interpreter of the remote server

There is a most important thing I want to remind before I start: to use the Python interpreter of remote server requires the professional version of PyCharm. The community version has no way to configure the remote Python interpreter. (If I make a mistake, please feel free to tell me.)

As you can see, the version of PyCharm is divided into professional version and community version

Fortunately, in addition to spending money to buy it, you can apply for a free professional version if you are a student and have a school email address. One application can be valid for one year.

You can go to the following website to apply: https://www.jetbrains.com/pycharm/download/#section=windows

If you want to know how to install PyCharm, maybe you can refer to this article: PyCharm Installation Tutorial, A famous Python IDE

Okay, let’s start!


Configure remote interpreter settings

First, I build a new project of the example.

It’s a new project.

Select File => Settings to open the setting window. Of course you can also use the shortcut key Ctrl + Alt + s to open it.

After opening, select Project: “YOUR_PROJECT_NAME” => Project Interpreter in the left bar.

Like this.

Click the gear in the upper right corner and select Add button. The add Python interpreter window pops up:

Select SSH Interpreter.

Select New server configuration, and fill in the connection settings in sequence. After selecting, select Next.

Enter the password of the connection account, and then select Next again.

For the remote Python interpreter, you can use ssh command to connect to it first, and use the following command to confirm where the Python interpreter is.

whereis python

Usually the path is approximately:

/usr/bin/python3.6

Above this is the path of my Python interpreter.

It is not recommended to preset the location of the synchronization folder, but it is better to create it separately. The method to change the path is to click on the folder icon on the right of step 2 in the figure, and then select the folder on the right of Remote Path again to select the folder you want to synchronize remotely.

Select Finish to end the configuration of the remote interpreter.


Hint

If PyCharm does not feel smooth or a bit stuck during remote synchronization, it may be because its background has been detecting whether to synchronize all files in the current folder. You can go to Tools => Deployment => to turn off Automatic Upload. Maybe it will be smoother.

If there is no manual upload file to the remote synchronization folder under Deployment, you can enter Configuration for configuration.

Configuration path

After configuring in order, there is probably no problem.

Leave a Reply