Skip to content

Instantly share code, notes, and snippets.

@nvie
Created March 1, 2013 11:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nvie/5064055 to your computer and use it in GitHub Desktop.
Save nvie/5064055 to your computer and use it in GitHub Desktop.
Use in place of `workon`. Put it in ~/bin.
#!/bin/sh
ENV="$1"
shift 1
VIRTUAL_ENV="${WORKON_HOME}/${ENV}"
if [ ! -f "${VIRTUAL_ENV}/bin/python" ]; then
echo "No virtualenv named '$ENV'."
exit 2
fi
# Activate
export VIRTUAL_ENV="$VIRTUAL_ENV"
export PATH="$VIRTUAL_ENV/bin:$PATH"
unset PYTHON_HOME
exec "${@:-$SHELL}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment