hobbes3
hobbes3

Reputation: 30238

Rename an environment with virtualenvwrapper

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.

Upvotes: 129

Views: 18172

Answers (2)

NickAldwin
NickAldwin

Reputation: 11754

You can use:

cpvirtualenv oldenv newenv
rmvirtualenv oldenv

So in your case:

cpvirtualenv doors django
rmvirtualenv doors

Upvotes: 229

Bengineer
Bengineer

Reputation: 7742

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

Upvotes: 8

Related Questions