How to resolve "Invalid Python interpreter name 'python.exe'!" error in PyCharm

Viewed 12849

I'm trying to add my Python interpreter to PyCharm but whenever I navigate to python.exe and click Ok it says Invalid Python interpeter name 'python.exe'! (the spelling mistake for interpeter is how it's spelled in the dialog that appears)

I installed Python through the Microsoft app store. The interpreter is located at ~\AppData\Local\Microsoft\WindowsApps\python.exe. This is the path I navigate to when selecting the interpreter in PyCharm. There are also python3.exe and python3.7.exe but those don't work either. I can run python from the command line and it behaves as expected.

5 Answers

I got the same error message when I imported a project of an existing virtual environment to pyCharm. Though the name and path of the exe was correct, pyCharm did not accept it. My solution was to remove the Interpreter in pyCharm and to add it again. Then the Error was gone. Perhaps that can help someone ...

The EAP (Early Access Program) build Pavel suggests did not work for me. I hope this gets sorted out in PY-33406 as Pavel suggests.

In the responses for that issue, the thing that worked for me is included. I created a virtual environment using venv and was able to use that python interpreter. As it says on that page...

  • Open the windows prompt
  • Go to the project root: cd X:\path\to\project
  • Type python -m venv venv
  • Chose "existing interpreter" instead of creating a new venv using Pycharm and pick the Python binary from the virtualenv you created in the previous step

Hope that helps, happy to update this to add more detail if not.

Remove the interpreter (by using minus sign) and add it again!

In case anyone else is still facing this issue, reinstalling PyCharm did the trick for me.

Related