We just looked at configuring a local interpreter. But we don’t always have a “local” environment. Sometimes – and increasingly often – our environment is over there.
我们刚刚看了配置本地解释器。但我们并不总是有一个“本地”的环境。有时候–而且越来越多的时候–我们的环境就在那里。
Let’s learn how to configure remote interpreters – SSH, Docker, Docker Compose, WSL, etc. in PyCharm Professional.
让我们学习如何在PyCharm Professional中配置远程解释器- SSH,Docker,Docker Compose,WSL等。
New Interpreter 新的解释器
As discussed in the previous step, to run your Python code you’ll need to configure at least one Python interpreter. In this step, we’re going to cover technologies for remote interpreters.
如前一步所述,要运行Python代码,您需要配置至少一个Python解释器。在这一步中,我们将介绍远程解释器的技术。
For all of these options, make sure you have Python downloaded and installed on your machine, as well as the technology you want to use.
对于所有这些选项,请确保您已经下载并安装了Python,以及您想要使用的技术。
To setup a remote Python interpreter, you can either:
要设置远程Python解释器,您可以:
Click the Python Interpreter widget in the Status Bar and choose ‘Add Interpreter’.
单击状态栏中的Python解释器小部件,然后选择“添加解释器”。
Go directly to the Add Interpreter screen in our Settings/Preferences ⌘, (macOS) / Ctrl+Alt+S (Windows/Linux) then click the gear icon and select Add.
直接转到设置/首选项 ⌘, (macOS)/ Ctrl+Alt+S (Windows/Linux)中的添加解释器屏幕,然后单击齿轮图标并选择添加。
Support for remote interpreters is part of PyCharm Professional’s offering. If you haven’t yet, I encourage you to try it now. It has a free 30-day trial.
支持远程解释器是PyCharm Professional提供的一部分。如果你还没有,我鼓励你现在就试试。它有30天的免费试用期。
SSH
Let’s start with remote interpreters using SSH. From the Add Python Interpreter dialog, click SSH Interpreter. You need to choose to either configure a new server or select an existing one. To configure a new server, select New server configuration and specify the server information, including host, port, and username before you click Next.
让我们从使用SSH的远程解释器开始。在Add Python Interpreter对话框中,单击SSH Interpreter。您需要选择配置新服务器或选择现有服务器。要配置新服务器,请选择“新建服务器配置”并指定服务器信息,包括主机、端口和用户名,然后单击“下一步”。
Next, we are going to provide authentic