[英]How do I configure a Python interpreter in IntelliJ IDEA with the PyCharm plugin?
There is a tutorial in the IDEA docs on how to add a Python interpreter in PyCharm, which involves accessing the "Project Interpreter" page. IDEA 文档中有关于如何在 PyCharm 中添加 Python 解释器的教程,其中涉及访问“项目解释器”页面。 Even after installing the Python plugin, I don't see that setting anywhere.
即使在安装 Python 插件之后,我也没有在任何地方看到该设置。
Am I missing something obvious?我错过了一些明显的东西吗?
With the Python plugin installed:安装 Python 插件后:
Provided you have a Python SDK installed, the flow should be natural from there - navigate to the location your Python installation lives.如果您安装了 Python SDK,那么流程应该很自然——导航到您的 Python 安装所在的位置。
So here is a simple project, where I have used Selenium
and added that using external path所以这是一个简单的项目,我在其中使用了
Selenium
并使用外部路径添加了它
Now you need to open Project Structure
and go to SDK
Section现在您需要打开
Project Structure
并转到SDK
部分
Now Select your project's virtual environment.现在选择您项目的虚拟环境。 In the
Classpath
tab add the PYTHONPATH
by clicking +
button在
Classpath
选项卡中,单击+
按钮添加PYTHONPATH
and now the modules will be recognized现在模块将被识别
I was getting the error (IntelliJ on Ubuntu 18.04) while python SDK was configured.配置 python SDK 时出现错误(Ubuntu 18.04 上的 IntelliJ)。
To fix that, I had to do this:为了解决这个问题,我必须这样做:
File
-> Project Structure
-> Modules
File
-> Project Structure
-> Modules
Click on the Dependencies
tab, and click on +
and select the python SDK单击
Dependencies
选项卡,然后单击+
并选择 python SDK
Click on Apply
点击
Apply
After that, the warning went away and autocompletion also started working properly在那之后,警告消失了,自动完成也开始正常工作
If you have multiple modules in your project, with different languages, you can set the interpreter in the following way:如果您的项目中有多个模块,使用不同的语言,您可以通过以下方式设置解释器:
File -> Project Structure...
Modules
in the list on the leftModules
New...
button to create either a virtualenv, or create a new Python SDK from a Python installation on your system.New...
按钮创建一个 virtualenv,或者从系统上的 Python 安装创建一个新的 Python SDK。Follow these steps:按着这些次序:
For Pycharm users: 对于Pycharm用户:
File ⟶ Settings ⟶ Project: MyProject ⟶ Project Interpreter 文件 ⟶ 设置 ⟶ 项目:MyProject⟶ 项目解释器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.