I am working on a Python project in Windows using a virtual environment (venv) created with python -m venv. When I try to activate the environment using venvScriptsactivate, the environment activates, but running pip or python results in an error pointing to an incorrect path from a different project:
Fatal error in launcher: Unable to create process using '"e:projectsmanufacturingvenvscriptspython.exe" "E:ProjectsmervenvScriptspip.exe" -V': The system cannot find the file specified.
- It seems that the virtual environment is still referencing the Python executable and paths from the old project (e:projectsmanufacturing) instead of the current one (e:projectsmer).
What I’ve Tried:
- Checked the venvScripts folder and found all activation scripts (activate, activate.bat, Activate.ps1), but none of them explicitly reference the incorrect path.
- Opened the pyvenv.cfg file in the virtual environment root, but it looks fine (no reference to the old path).
- I know I can recreate venv. but just why?
What I Need:
-
Where might this incorrect path be hardcoded in the virtual
environment? -
How can I fix it without recreating the virtual
environment? -
Could this be related to the pip configuration or
cached paths, and how do I resolve it?
Thanks in advance.
1