Skip to content

Instantly share code, notes, and snippets.

@rosenhouse
Last active December 27, 2015 16:49
Show Gist options
  • Save rosenhouse/7357628 to your computer and use it in GitHub Desktop.
Save rosenhouse/7357628 to your computer and use it in GitHub Desktop.
python virtualenv for the lazy
#!/bin/bash -e
if [ "${BASH_SOURCE[0]}" == "${0}" ]; then
echo "source this!"
exit 1
fi
if [ ! "$1" ]; then
echo "Name an environment!"
return 2
fi
ve_root="$HOME/.virtualenvs"
mkdir -p $ve_root
pushd $ve_root
export VE="$ve_root/$1"
if [ ! -d "$1" ]; then
virtualenv $1
else
echo "Existing virtualenv found."
fi
echo "Virtualenv path stored into shell env var 'VE'"
source $1/bin/activate
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment