Skip to content

Instantly share code, notes, and snippets.

Last active June 5, 2018 09:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rthill/6a663577f7fb17e747699dec668d25bc to your computer and use it in GitHub Desktop.
Python virtualenv wrapper script
Add into your .bashrc on macOS the following alias:
alias workon='source ~/bin/'
I believe on Linux the alias should look like:
alias workon='~/bin/'
# Workon virtualenv wrapper
DIR=`find $VENVDIR -maxdepth 1 -type d -iname $ENV -print -quit`
if [[ ! -z "${DIR}" ]]; then
echo "Activating virtualenv $ENV"
if [[ ! -z "$VIRTUAL_ENV" ]]; then
echo "Deactivating old virtualenv"
source $DIR/bin/activate
echo "Cannot find virtualenv!"
echo "Valid virtualenvs:"
find $VENVDIR -maxdepth 1 -type d -execdir echo " {}" \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment