Python 如何将解释器添加到 PyCharm?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32768371/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 12:12:58  来源:igfitidea点击:

How can I add interpreter to PyCharm?

pythonpycharminterpreter

提问by Руслан Шамсудинов

When I try to run code in editor,it says that there is no available interpreters.Please,help.How can I solve the problem?

当我尝试在编辑器中运行代码时,它说没有可用的解释器。请帮助。我该如何解决这个问题?

回答by RataDP

Just read the PyCharm's Docs.

只需阅读 PyCharm 的文档。

https://www.jetbrains.com/pycharm/quickstart/configuring_interpreter.html

https://www.jetbrains.com/pycharm/quickstart/configuring_interpreter.html

Step by step:

一步步:

  1. Go to Settings.
  2. Go to the section Project Interpreter.
  3. Click on the plus (+)button and select the Localoption.
  4. Search for the interpreter, in Linux it is used to be in /usr/bin/pythonor /usr/bin/pythonX.Ywhere X and Y are the version. In Windows, it is used to be in C:\python.
  5. Last step save the settings and you have configured the interpreter.
  1. Settings
  2. 转到 部分Project Interpreter
  3. 单击加号(+)按钮并选择该Local选项。
  4. 搜索解释器,在 Linux 中它用于 in/usr/bin/python/usr/bin/pythonX.Y其中 X 和 Y 是版本。在 Windows 中,它曾经在C:\python.
  5. 最后一步保存设置,您已经配置了解释器。

PD: If you are on Linux python is installed and if you are using Windows, you can download from here: https://www.python.org/downloads/windows/

PD:如果你在 Linux 上安装了 python 并且你使用的是 Windows,你可以从这里下载:https: //www.python.org/downloads/windows/

回答by ShawnZhu

This page Configuring Python Interpretertells all the information you need.

这个页面配置 Python 解释器告诉你需要的所有信息。

To configure Python virtual environment, follow these steps:

要配置 Python 虚拟环境,请按照下列步骤操作:

  1. In the Settings/Preferences dialog (?,), click Project Interpreter.
  2. Click gear icon and choose Add .... enter image description here
  3. In the left-hand pane of this dialog, click the Virtual Environment node.
  4. Click OK to apply changes and close the dialog box.
  1. 在“设置/首选项”对话框 (?,) 中,单击“项目解释器”。
  2. 单击齿轮图标并选择添加...。 在此处输入图片说明
  3. 在此对话框的左侧窗格中,单击 Virtual Environment 节点。
  4. 单击确定应用更改并关闭对话框。

回答by Chuze

I think it's better to run this command

我认为最好运行这个命令

$ sudo apt-get install python3-distutils

$ sudo apt-get install python3-distutils