Changing your virtualenv’s directory
This note shows how to change the directory of your virtualenv without breaking the PATH of your packages.
Step 1:
copy & paste the your virtualenv to wherever you want to transfer it.
$ cp -R ~/old_directory/env ~/new_directory/env
Step 2:
Now it will (surely) not work properly and will get a bunch of error messages
go to env’s bin directory to fix the activate script
$ cd ~/new_directory/env/bin
$ nano activate # edit the activate file
then change the VIRTUAL_ENV to the new location of the env
VIRTUAL_ENV=“~/new_directory/env” # In this case
Step 3:
Your virtualenv now will work properly but you need to fix your pip script because the path for the python that is harcoded at the top of the script is still set to the old directory
$ cd ~/new_directory/env/bin
$ nano pip # edit the pip file
At the top most part of the script change the path of your python
#!~/new_directory/env/bin/python
That’s it!


















