Skip to content

Instantly share code, notes, and snippets.

@aubricus
Created May 30, 2014 01:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aubricus/a7d7d934e28b3544e1b9 to your computer and use it in GitHub Desktop.
Save aubricus/a7d7d934e28b3544e1b9 to your computer and use it in GitHub Desktop.
virtualenvwrapper config
export WORKON_HOME=$HOME/.virtualenv
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_REQUIRE_VIRTUALENV=true
export PIP_RESPECT_VIRTUALENV=true
# If virtualenv wrapper exists in these locations...
venvwrappers[0]="/usr/local/share/python/virtualenvwrapper.sh"
venvwrappers[1]="$HOME/.virtualenv/default/bin/virtualenvwrapper.sh"
venvwrappers[2]="/usr/local/bin/virtualenvwrapper.sh"
# Try loading venvwrappers.
for venvwrapper in "${venvwrappers[@]}"
do
if [ -f $venvwrapper ]; then
# echo "Loading: ${venvwrapper}"
. $venvwrapper
fi
done
# If default venv exists...
default_env="$WORKON_HOME/default"
if [ -d "$default_env" ]; then
# Load it.
. ${default_env}/bin/activate
else
# Create & load it.
virtualenv $default_env
. $default_env/bin/activate
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment