Changed my dir name from a test/development directory name to a proper name for release. (changed to "project" for this question because the actual name is rather long)
Now when I activate my venv, I get the following:
(virtualEnv) PS ~\Desktop\dev\vbvarsel> pip --list
Fatal error in launcher: Unable to create process using '"~\Desktop\dev\project_0.0.1\virtualEnv\Scripts\python.exe" "~\Desktop\dev\project\virtualEnv\Scripts\pip.exe" --list': The system cannot find the file specified.
I went into my pyvenv.cfg, and the activate scripts to modify the path to the venv's python and pip exes (this is the correct one ~\Desktop\dev\project\virtualEnv
), but it doesn't seem to be registering this? This [~\Desktop\dev\project_0.0.1\virtualEnv\Scripts\python.exe
] is causing the error, it is looking at the wrong directory, I don't know where it is reading that from. It is not a system variable, if I search the files in this directory, it doesn't yield any results. Have I just completely borked it and need to start from scratch with my virtual environment?
I am on Windows 11, using VSCode, if that should help.
You can't easily move or rename virtualenvs once they're created (nor can you use a virtualenv if the base interpreter you used to create it is gone, but that's not the case here).
Your easiest bet is to simply recreate the virtualenv and trash the old one – and that should be fine! Virtualenvs shouldn't be precious and special.
If you need the exact packages you had in there (e.g. you don't have a requirements.txt
or pyproject.toml
for your requirements yet), place the virtualenv back where it was, activate it, run pip freeze > frozen-requirements.txt
; you can then pip install -r frozen-requirements.txt
in the new virtualenv.