Skip to content

Instantly share code, notes, and snippets.



Created Jan 8, 2014
What would you like to do?
Python virtualenvwrapper
# This hook is run after every virtualenv is activated.
#create project directory and cd into it
env_name="`basename \"$VIRTUAL_ENV\"`"
if [ ! -d "$pwd_root" ] ; then
echo "Creating directory $pwd_root"
mkdir "$pwd_root"
cd "$pwd_root"
#colorful env name
PS1="\[\033[33m\](`basename \"$VIRTUAL_ENV\"`)$_OLD_VIRTUAL_PS1"

This comment has been minimized.

Copy link
Owner Author

@Bouke Bouke commented Jan 8, 2014

This hook will create a folder with the same name as the virtual environment in ~/Sites/. If the name contains -py3, that's stripped from the name. This allows you to share a folder for between Python 2 and 3 virtual environments.

The last command uses some lively colors for the name of the virtual environment in your prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.