Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 330
hobbes3 Avatar asked Oct 06 '22 03:10

hobbes3


People also ask

What is the difference between virtualenv and virtualenvwrapper?

Virtualenvwrapper is a utility on top of virtualenv that adds a bunch of utilities that allow the environment folders to be created at a single place, instead of spreading around everywhere.

What is difference between Env and VENV?

I want to install and run multiple applications with different, conflicting dependencies. Then use virtualenv or venv. These are almost completely interchangeable, the difference being that virtualenv supports older python versions and has a few more minor unique features, while venv is in the standard library.

Can I move a virtualenv folder?

Yes. It is possible to move it on the same platform. You can use --relocatable on an existing environment.


2 Answers

You can use:

cpvirtualenv oldenv newenv
rmvirtualenv oldenv

So in your case:

cpvirtualenv doors django
rmvirtualenv doors
like image 220
NickAldwin Avatar answered Oct 07 '22 17:10

NickAldwin


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
like image 8
Bengineer Avatar answered Oct 07 '22 16:10

Bengineer