Created
June 16, 2018 12:02
-
-
Save danieltomasz/d09afcb0ae0af42574ae796bd85e7b51 to your computer and use it in GitHub Desktop.
moving python virtualenv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd ~/first | |
$ virtualenv my-venv | |
$ grep 'VIRTUAL_ENV=' my-venv/bin/activate | |
VIRTUAL_ENV="/home/username/first/my-venv" | |
$ virtualenv --relocatable my-venv | |
Making script my-venv/bin/easy_install relative | |
Making script my-venv/bin/easy_install-2.7 relative | |
Making script my-venv/bin/pip relative | |
Making script my-venv/bin/pip2 relative | |
Making script my-venv/bin/pip2.7 relative | |
### Note that `activate` has not been touched | |
$ mkdir ~/second | |
$ mv my-venv ~/second | |
$ cd ~/second | |
$ grep 'VIRTUAL_ENV=' my-venv/bin/activate | |
VIRTUAL_ENV=/home/username/first/my-venv | |
### (This variable hasn't been changed, it still refers to the old, now non-existent directory!) | |
$ sed -i -e 's|username/first|username/second|' my-venv/bin/activate | |
## sed can be used to change the path. | |
## Note that the `-i` (in place) flag won't work on all machines. | |
$ source my-venv/bin/activate | |
source https://stackoverflow.com/questions/32407365/can-i-move-a-virtualenv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment