ChatGPT解决这个技术问题 Extra ChatGPT

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

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.

Do you have Python installed? If not, there's your problem.
What operating system are you using?

T
Tony Adams

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.

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).

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

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

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

Open your settings dialogue CTRL + ALT + S Then you will need to type in interpreter in the search box: 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. 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. 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.


Thanks for the solution. I just wanted to say that the user have to hide the taskbar on windows in order to see the ok button :)
No virtualenv here, and python is installed to the default location as well. Still had this issue. The answer here helped get me to the point to where it was working, however I had to restart pycharm to make the changes for some odd reason.
This did not work with Ubuntu 16.04, PyCharm edition 2017.2.1. There isn't even "Python Interpreters" under "Project Interpreter" as depicted in the screenshot.
At first I chuckled and thought "noob mistake by OP! ha!"....and then I realized that was exactly my problem ^_^! Time to install...
This same solution worked on Ubuntu too. Thanks for the solution.
j
jaor

Go to 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.


Thank you for answering my quastion, by python binary, is that the PyCharm image file??
@Tedpottel python binary is what you are using to run your Python scripts, like d:\dev\Python27\python.exe on Windows or /usr/bin/python on Mac/Linux.
This was the easiest answer. Works well!
A
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.

Then I went here to reinstall the interpreter: 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.


u
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".


D
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/

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

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


b
bizimunda

for mac I can tell you that first you have to check your path

by executing this command

which python or which python3

https://i.stack.imgur.com/ISJui.png

then you have to configure it in your pycharm.

pycharm-->preferences-->gear button-->add..

https://i.stack.imgur.com/GxNxL.png

click on system interpreter--> then on ...

then you search where your python version is installed

https://i.stack.imgur.com/Kdoll.png

once it is done then you have to configure for your project

click on edit configuration

https://i.stack.imgur.com/CvLX2.png

then choose the python interpreter

https://i.stack.imgur.com/IgZrb.png


b
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 interpreter than select Python 3.6 in the dropdown menu.

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.

(on PyCharm 2018.2.4 Community Edition)


A
Arslan Ahmad khan

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

download python setup

install this solved my problem.

for more help visit 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"


E
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.


1
10 Rep

In Linux, it was solved by opening PyCharm from the terminal and leaving it open. After that, I was able to choose the correct interpreter in preferences. In my case, linked to a virtual environment (venv).


N
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!


s
shottootto

I had the same problem and stumbled onto this solution. I ran PyCharm (as administrator, though not sure if necessary). After PyCharm has completely loaded (green tick mark top right), see bottom right. Click on it. An interface will open. In my case the path was already there. I just clicked OK and all was fine. closed PyCharm and ran it again normally. Still all fine.


Sorry - That must be "See bottom right"