简体   繁体   English

PyCharm 没有找到 Anaconda Python,给出“无法打开文件 'python':[Errno 2] 没有这样的文件或目录?”

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

I am new to Python.我是 Python 的新手。 Installed Anaconda on my system.在我的系统上安装了 Anaconda。 I installed PyCharm too.我也安装了 PyCharm。 When I try to run a file from PyCharm I get this error message:当我尝试从 PyCharm 运行文件时,我收到以下错误消息:

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 C:\\Python\\Test\\venv\\Scripts\\python.exe python 3.6 C:/Python/Test/while.py C:\\Python\\Test\\venv\\Scripts\\python.exe:无法打开文件“python”: [Errno 2] 没有那个文件或目录

You have mentioned that you have already installed the Anaconda in your system.您已经提到您已经在系统中安装了 Anaconda。 You can try the following,您可以尝试以下方法,

  1. Go to Project Interpreter in Pycharm转到 Pycharm 中的项目解释器
  2. Under Conda Environment, choose the Existing Environment and select the python.exe from the Anaconda Installation folder in the Interpreter field.在 Conda Environment 下,选择 Existing Environment 并从 Interpreter 字段的 Anaconda Installation 文件夹中选择 python.exe。
  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.您现在应该能够在 Project Interpreter 中看到这些库。

It seems that you have virtual environment installed without python version.您似乎安装了没有 python 版本的虚拟环境。 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 .如果您是 Python 新手,最好遵循最简单的路径:从Python 网站下载 python 2.7 或 3.6。

If you run the installer, you should find the python folder in C:\\Python27 or C:\\Python36.如果您运行安装程序,您应该会在 C:\\Python27 或 C:\\Python36 中找到 python 文件夹。

Then you should assert that this folder is in windows paths, set them in Enviromental variables in System property.然后你应该断言这个文件夹在 windows 路径中,在系统属性的环境变量中设置它们。

For the last step you need to set Python interpreter in PyCharm:对于最后一步,您需要在 PyCharm 中设置 Python 解释器:

File -> Settings -> Build, Execution, Deployment -> Console -> Python Console -> Python interpreter文件 -> 设置 -> 构建、执行、部署 -> 控制台 -> Python 控制台 -> Python 解释器

and set as interpreter the python.exe file in your X:/PythonNN folder并将 X:/PythonNN 文件夹中的 python.exe 文件设置为解释器

在 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).我在 Pycharm 社区版 (CE) 上遇到了同样的问题。 Solved it by switching to Pycharm Professional.通过切换到 Pycharm Professional 解决了这个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PyCharm 没有找到 Anaconda Python,给出“无法打开文件 'python.py':[Errno 2] 没有这样的文件或目录?” - PyCharm not finding Anaconda Python, giving “can't open file 'python.py': [Errno 2] No such file or directory?” OSX终端在启动时给出消息“ Python:无法打开文件'=':[Errno 2]没有这样的文件或目录” - OSX terminal giving the message “Python: can't open file '=': [Errno 2] No such file or directory” upon startup python:无法打开文件'python2':[Errno 2]没有这样的文件或目录 - python: can't open file 'python2': [Errno 2] No such file or directory python:无法打开文件“帮助”:[Errno 2]没有此类文件或目录 - python: can't open file 'help': [Errno 2] No such file or directory python:无法打开文件“C:\\Program”:[Errno 2] 没有这样的文件或目录 - python: can't open file 'C:\Program': [Errno 2] No such file or directory 无法打开文件'python':[Errno 2]没有这样的文件或目录 - can't open file 'python': [Errno 2] No such file or directory 在Python中使用3to2,得到“ python:无法打开文件'3to2':[Errno 2]没有这样的文件或目录” - Using 3to2 in Python, get “python: can't open file '3to2': [Errno 2] No such file or directory” python:无法打开文件'python DACscrap.py&':[Errno 2]没有这样的文件或目录…但是可以吗? - python: can't open file 'python DACscrap.py &': [Errno 2] No such file or directory… but it does? 如何解决 docker 的 PyCharm 错误“无法打开文件 'path/to/file.py': [Errno 2] No such file or directory”? - How to solve PyCharm error with docker "can't open file 'path/to/file.py': [Errno 2] No such file or directory"? 无法打开文件:[Errno 2] 没有那个文件或目录 - can't open file : [Errno 2] No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM