Skip to content
Advertisement

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

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:

enter image description here


Edit 4

This is the current state:

enter image description here

I think this is related.

Advertisement

Answer

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.

enter image description here

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.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement