Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 773
indynt Avatar asked Mar 16 '26 15:03

indynt


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

like image 50
Harald Avatar answered Mar 19 '26 04:03

Harald


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.

like image 34
Rafael Zayas Avatar answered Mar 19 '26 03:03

Rafael Zayas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!