Invalid Python interpreter selected for the project

I use Pycharm, and whenever I move a project to another folder, it says “invalid python interpreter selected for the project”. I think it happens because the path to venv has changed.

I tried Configure Python Interpreter > Add Interpreter > Select “Existing Environment” with the new path to venv. I was expecting this to work, but after I click OK, it says “Updating interpreter path” for a moment, and nothing changes. I tried even checking “make available to all projects”.

I also tried some of stack overflow answers, but couldn’t make it. How can I fix this?

Error:Cannot run program "C:UsersakshaPycharmDigital ClockvenvScriptspython.exe" (in directory "C:UsersakshaPycharm60 Python ProjectsDigital Clock"): CreateProcess error=2, The system cannot find the file specified


Virtualenv has hardcoded path inside the bin/activate file, which will fail when you move the virtualenv.

One way is to recreate your virtualenv. Another way is to open the file bin/activate and find this line VIRTUAL_ENV='/private/tmp/test2/.venv' and replace it with your new virtualenv path.

My virtualenv is created at /tmp/test2/.venv for reference.