简体   繁体   中英

PyCharm not finding Anaconda Python, giving "can't open file 'python': [Errno 2] No such file or directory?"

I am new to Python. Installed Anaconda on my system. I installed PyCharm too. When I try to run a file from PyCharm I get this error message:

C:\\Python\\Test\\venv\\Scripts\\python.exe python 3.6 C:/Python/Test/while.py C:\\Python\\Test\\venv\\Scripts\\python.exe: can't open file 'python': [Errno 2] No such file or directory

You have mentioned that you have already installed the Anaconda in your system. You can try the following,

  1. Go to Project Interpreter in Pycharm
  2. Under Conda Environment, choose the Existing Environment and select the python.exe from the Anaconda Installation folder in the Interpreter field.
  3. Enable the option, Make available to all projects and click ok.

You should now be able to see the libraries in the Project Interpreter.

It seems that you have virtual environment installed without python version. If you are new to Python, it may be better if you follow the easiest path: download python 2.7 or 3.6 from Python website .

If you run the installer, you should find the python folder in C:\\Python27 or C:\\Python36.

Then you should assert that this folder is in windows paths, set them in Enviromental variables in System property.

For the last step you need to set Python interpreter in PyCharm:

File -> Settings -> Build, Execution, Deployment -> Console -> Python Console -> Python interpreter

and set as interpreter the python.exe file in your X:/PythonNN folder

在 Conda Environment 下,您可以尝试选择 X:\\Anaconda3\\Scripts\\conda.exe。

我遇到了同样的问题,然后通过以管理员身份运行 PyCharm 解决了它。

您使用的命令是错误的,请尝试:

C:\Python\Test\venv\Scripts\python3.exe  C:/Python/Test/while.py 

I had the same problem with the Pycharm Community Edition (CE). Solved it by switching to Pycharm Professional.

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