PyCharm error: Cannot run program, error=2, No such file or directory(PyCharm 错误:无法运行程序,错误=2,没有这样的文件或目录)
问题描述
尝试在 PyCharm 中执行 Python 代码时收到以下错误消息:
<块引用>无法运行程序/Users/x/.virtualenvs/untitled/bin/python"(在目录/Users/x/PycharmProjects/untitled"中):error=2,没有这样的文件或目录
我确保所有内容都已更新并重新启动我的计算机,但我仍然遇到同样的错误.我不知道是什么问题.
编辑
我刚刚打开我的终端并遇到此错误消息:
virtualenvwrapper_run_hook:12:没有这样的文件或目录:/usr/local/bin/python3.7 virtualenvwrapper.sh:运行初始化挂钩时出现问题.
如果 Python 无法导入模块 virtualenvwrapper.hook_loader,请检查是否为 VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.7 安装了 virtualenvwrapper,并且 PATH 设置正确.
我不知道这里发生了什么.我当然没有碰过这些.
编辑 2
如果我执行 Python3 --version
,我会得到 Python 3.8.5
.
编辑 3
我关注了
编辑 4
这是当前状态:
我认为
在过去,我重新创建了项目并将项目文件直接从旧文件夹复制到文件资源管理器(不是 pycharm)中的新文件夹并修复它.
I am getting the following error message when attempting to execute Python code in PyCharm:
Cannot run program "/Users/x/.virtualenvs/untitled/bin/python" (in directory "/Users/x/PycharmProjects/untitled"): error=2, No such file or directory
I made sure everything was updated and restarted my computer, but I still get the same error. I have no idea what the problem is.
Edit
I just opened my terminal and was faced with this error message:
virtualenvwrapper_run_hook:12: no such file or directory: /usr/local/bin/python3.7 virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.7 and that PATH is set properly.
I have no idea what happened here. I certainly didn't touch any of this.
Edit 2
If I execute Python3 --version
, I get Python 3.8.5
.
Edit 3
I followed this, but this error remains:
Edit 4
This is the current state:
I think this is related.
If it helps at all this is what my venv settings looks like.
I don't have the answer as to why it happens, but I find its usually when renaming the project.
In the past i've recreated the project and copied the project files directly from the old folder to the new one in a file explorer (not pycharm) and its fixed it.
这篇关于PyCharm 错误:无法运行程序,错误=2,没有这样的文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!