invalid symlink error in pycharm python project

Viewed 2152

Started to learn python a few weeks ago, i made and ran some basic files. all worked well. At one point i uninstalled python and reinstalled it. i continued making and running new files no problem.

now i am trying to go back to and run some of my old files and i am getting an error.

Error:Cannot run program "/Users/paulthomas/PycharmProjects/plotting/venv/bin/python" (in directory "/Users/paulthomas/PycharmProjects/plotting"): error=2, No such file or directory

In pycharm i open the folders and hover over the python file section and it says i have a symlink error. How can i fix it? i have been using pipenv in my newer projects as they are django projects. But this project im trying to get to run is just a basic python project.

enter image description here

1 Answers

If you have reinstalled python, it is likely that the virtual env is linking to the wrong original python binaries.

You can either relink the files (by finding what they should have linked to, and relinking them) or if you have a requirements.txt file for the environment, delete and recreate the virtual env.

You can either do this through pycharm's environments system, or by using:

python3 -m venv <your environment name>

From your screenshot, your environment name is venv.

If the reinstalled python is a different version, it's likely safer to recreate the virtual env than to try linking things that may end up being inconsistent.

Related