试图让 PyC​​harm 工作,不断得到“没有选择 Python 解释器"; [英] Trying to get PyCharm to work, keep getting "No Python interpreter selected"

查看:23
本文介绍了试图让 PyC​​harm 工作,不断得到“没有选择 Python 解释器";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.这意味着,如果您使用的是 Windows,则您尚未下载 Windows 安装程序,您可以在 Python 官方网站上找到该安装程序.

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

如果你有,PyCharm 很可能找不到你的 Python 安装,因为它不在默认位置,通常是 C:Python27C:Python33(至少对我来说).

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

所以,如果您已经安装了 Python,但仍然出现此错误,那么可能发生了两件事:

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

  1. 您使用了 virtualenv 并且该 virtualenv 已被删除或文件路径已更改.在这种情况下,您将不得不继续阅读此答案的下一部分.
  2. 您的 python 安装不在其默认位置,在这种情况下,您需要找到它的位置,并找到 python.exe 文件.
  1. You use a virtualenv and that virtualenv has 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.exe file.

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

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

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

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

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

在旁边你会看到几个选项图标,点击大的+图标,然后点击local,因为你的解释器在这台电脑.

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 this computer.

这将打开一个对话框.确保选择该目录的 python.exe 文件,不要给 pycharm 整个目录.它只需要解释器.

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

这篇关于试图让 PyC​​harm 工作,不断得到“没有选择 Python 解释器";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆