简体   繁体   中英

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.

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.

删除解释器(通过使用减号)并再次添加它!

Try PyCharm 2019.2 EAP build . The problem should be fixed: https://youtrack.jetbrains.com/issue/PY-33406 (or better use Python from python.org).

I reported the typo to PyCharm's bug tracker, thanks https://youtrack.jetbrains.com/issue/PY-36686

如果其他人仍然面临这个问题,重新安装 PyCharm 对我有用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM