Rename an environment with virtualenvwrapper
-
03-12-2019 - |
Question
I have an environment called doors
and I would like to rename it to django
for the virtualenvwrapper.
I've noticed that if I just rename the folder ~/.virtualenvs/doors
to django
, I can now call workon django
, but the environment still says (doors)hobbes3@hobbes3
.
La solution
You can use:
cpvirtualenv oldenv newenv
rmvirtualenv oldenv
So in your case:
cpvirtualenv doors django
rmvirtualenv doors
Autres conseils
if you do:
$ ack-grep -ai doors ~/.virtualenvs/django/bin
you'll notice that will have doors
as location and not django, you'll to change each file with the new location.
solution: after renamed the folder execute the command below.
$ sed -i "s/doors/django/g" ~/.virtualenvs/django/bin/*
now if you do:
$ workon django
(django)hobbes3@hobbes3
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow