After my project name was changed, when I activate my environment in my project, it shows activated but doesn't work
in wsl2
Asked
Active
Viewed 38 times
0
-
1https://stackoverflow.com/a/43396657/7976758 You shouldn't rename a virtualenv, you should recreate it. See https://stackoverflow.com/search?q=%5Bvirtualenv%5D+rename – phd Aug 30 '23 at 19:10
-
1what is `ac`? It isn't clear to me exactly what is going on. What do you mean "my project name was changed"? What exactly did you do? – juanpa.arrivillaga Aug 30 '23 at 19:32
-
1as an aside, please **always** use the generic [python] tag for all python related questions. It is 2022. Python 2 is years past it's end of life. There is no need to specify python 3, *python 3 is python* – juanpa.arrivillaga Aug 30 '23 at 19:33
-
1Does this answer your question? [Renaming a virtualenv folder without breaking it](https://stackoverflow.com/questions/6628476/renaming-a-virtualenv-folder-without-breaking-it) – Dmitry Semenov Aug 30 '23 at 20:18
1 Answers
-1
Renaming your project’s directory or environment will break your virtual environment.
Your virtual environment WILL use absolute paths.
The proper solution is DELETING AND RECREATING THEM
You can also use the flag --relocatable
virtualenv --relocatable ENV
This flag will make your virtual environment packages relative. But even so, the absolute path is still hardcoded in the activate script.
TL;DR: Just delete and recreate them if you ever have to rename them.

Pedro Santos
- 25
- 6