试图让 PyC​​harm 工作,不断得到“没有选择 Python 解释器”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19645527/
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 14:15:50  来源:igfitidea点击:

Trying to get PyCharm to work, keep getting "No Python interpreter selected"

pythonpycharm

提问by Ted pottel

I'm trying to learn Python and decided to use PyCharm. When I try to start a new project I get a dialog that says "No Python interpreter selected". It has a drop down to select a interpreter, but the drop down is empty.

我正在尝试学习 Python 并决定使用 PyCharm。当我尝试开始一个新项目时,我收到一个对话框,上面写着“没有选择 Python 解释器”。它有一个下拉选择解释器,但下拉是空的。

采纳答案by Games Brainiac

Your problem probably is that you haven't installedpython. Meaning that, if you are using Windows, you have not downloaded the installer for Windows, that you can find on the official Python website.

你的问题可能是你没有安装python。这意味着,如果您使用的是 Windows,则您尚未下载适用于 Windows 的安装程序,您可以在 Python 官方网站上找到该程序。

In case you have, chances are that PyCharm cannot find your Python installation because its not in the default location, which is usually C:\Python27or C:\Python33(for me at least).

如果您有,很可能 PyCharm 找不到您的 Python 安装,因为它不在默认位置,这通常是C:\Python27C:\Python33(至少对我而言)。

So, if you haveinstalled Python and it still gives this error, then there can be two things that have happened:

所以,如果你已经安装了Python和它仍然给这个错误,那么就可以说已经发生了两件事情:

  1. You use a virtualenvand that virtualenvhas been deleted or the filepath changed. In this case, you will have to find proceed to the next part of this answer.
  2. Your python installation is not in its default place, in which case you will need to find its location, and locate the python.exefile.
  1. 您可以使用virtualenv,并且virtualenv已被删除或文件路径发生变化。在这种情况下,您将不得不继续阅读本答案的下一部分。
  2. 您的 python 安装不在其默认位置,在这种情况下,您需要找到它的位置,并找到该python.exe文件。

Once you have located the necessary binaries, you will need to tell PyCharm were to look:

找到必要的二进制文件后,您需要告诉 PyCharm 要查看:

  1. Open your settings dialogue CTRL+ ALT+ S
  2. Then you will need to type in interpreterin the search box:

    enter image description here

  3. As you can see above, you will need to go to Project Interpreterand then go to Python Interpreter. The location has been selected for you in the above image.

  4. To the side you will see a couple of options as icons, click the big +icon, then click on local, because your interpreter is on thiscomputer.

  5. This will open up a dialogue box. Make sure to select the python.exefile of that directory, do not give pycharm the whole directory. It just wants the interpreter.

  1. 打开您的设置对话框CTRL+ ALT+S
  2. 然后你需要interpreter在搜索框中输入:

    在此处输入图片说明

  3. 正如您在上面看到的,您需要转到Project Interpreter,然后转到Python Interpreter。已在上图中为您选择了位置。

  4. 在一侧,您将看到几个选项作为图标,单击大+图标,然后单击local,因为您的口译员在计算机上。

  5. 这将打开一个对话框。一定要选择python.exe那个目录的文件,不要把整个目录给pycharm。它只需要口译员。

回答by jaor

Go to File->Settings->Project Settings->Project Interpreter->Python Interpreters

File->Settings->Project Settings->Project Interpreter->Python Interpreters

There will be a "+" sign on the right side. Navigate to your python binary, PyCharm will figure out the rest.

右侧会有一个“+”号。导航到您的 python 二进制文件,PyCharm 会找出其余的。

回答by user6845508

During the install of python make sure you have "Install for all users" selected. Uninstall python and do a custom install and check "Install for all users".

在安装 python 期间,请确保选择了“为所有用户安装”。卸载 python 并进行自定义安装并选中“为所有用户安装”。

回答by AeFinches

This situation occurred to me when I uninstalled a method and tried to reinstall it. My very same interpreter, which worked before, suddenly stopped working. And this error occurred.

当我卸载一个方法并尝试重新安装它时,我遇到了这种情况。我以前工作过的同一个翻译突然停止工作。并且发生了这个错误。

I tried restarting my PC, reinstalling Pycharm, invalidating caches, nothing worked.

我尝试重新启动我的电脑,重新安装 Pycharm,使缓存无效,但没有任何效果。

Then I went here to reinstall the interpreter: https://www.python.org/downloads/

然后我去这里重新安装了解释器:https: //www.python.org/downloads/

When you install it, there's an option to fix the python.exe interpreter. Click that. My IDE went back to normal working conditions.

安装它时,有一个选项可以修复 python.exe 解释器。单击那个。我的 IDE 恢复到正常工作状态。

回答by Darshan Jain

Even I got the same issue and my mistake was that I didn't download python MSI file. You will get it here: https://www.python.org/downloads/

即使我遇到了同样的问题,我的错误是我没有下载 python MSI 文件。你会在这里得到它:https: //www.python.org/downloads/

Once you download the msi, run the setup and that will solve the problem. After that you can go to File->Settings->Project Settings->Project Interpreter->Python Interpreters

下载 msi 后,运行安装程序即可解决问题。之后,您可以转到 File->Settings->Project Settings->Project Interpreter->Python Interpreters

and select the python.exe file. (This file will be available at c:\Python34) Select the python.exe file. That's it.

并选择 python.exe 文件。(该文件位于 c:\Python34)选择 python.exe 文件。就是这样。

回答by Nandan Kulkarni

You don't have Python Interpreter installed on your machine whereas Pycharm is looking for a Python interpreter, just go to https://www.python.org/downloads/and download python and then create a new project, you'll be all set!

您的机器上没有安装 Python 解释器,而 Pycharm 正在寻找 Python 解释器,只需访问https://www.python.org/downloads/并下载 python,然后创建一个新项目,您就可以了放!

回答by bayramcicek

If you are using Ubuntu, Python has already been downloaded on your PC. so, go to -> ctrl+ alt+ s-> search interpreter-> go to project interpreterthan select Python 3.6in the dropdown menu.

如果您使用的是 Ubuntu,则 Python 已经下载到您的 PC 上。所以,去 -> ctrl+ alt+ s-> 搜索interpreter-> 去project interpreterPython 3.6在下拉菜单中选择。

Edit:If there is no Python interpreter in drop-down menu, you should click the gear icon that on the right of the drop-down menu --> add--> select an interpreter.

编辑:如果下拉菜单中没有 Python 解释器,您应该单击下拉菜单右侧的齿轮图标 --> add--> 选择一个interpreter.

(on PyCharm 2018.2.4 Community Edition)

(在 PyCharm 2018.2.4 社区版上)

回答by Arslan Ahmad

I got the same issue when i newly installed pycharm in my windows 10 machine.

当我在 Windows 10 机器上新安装 pycharm 时,我遇到了同样的问题。

  • download python setup

  • install this solved my problem.

  • 下载python设置

  • 安装这个解决了我的问题。

for more help visitgoodluck

如需更多帮助,请访问goodluck

During the install of python make sure you have "Install for all users" selected. Uninstall python and do a custom install and check "Install for all users"

在安装 python 期间,请确保选择了“为所有用户安装”。卸载 python 并进行自定义安装并选中“为所有用户安装”

回答by Egret

In my case, there are several interpreters, but I have to manually add them.

就我而言,有几个解释器,但我必须手动添加它们。

To the right of where you see "No Interpreters", there is a gear icon. Click the gear icon -> Click "Add...", then you can add the ones you need.

在您看到“无口译员”的右侧,有一个齿轮图标。单击齿轮图标 -> 单击“添加...”,然后您可以添加您需要的。