PyCharm error: Cannot run program, error=2, No such file or directory

半城伤御伤魂 提交于 2020-08-10 19:31:34

问题


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.

I would greatly appreciate it if people would please take the time to help fix this.

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.

EDIT2:

If I execute Python3 --version, I get Python 3.8.5.

EDIT3:

I followed this, but this error remains:

EDIT4:

This is the current state:

I think this is related.


回答1:


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.



来源:https://stackoverflow.com/questions/63223548/pycharm-error-cannot-run-program-error-2-no-such-file-or-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!