Skip to content

Instantly share code, notes, and snippets.

@elijahr
Created July 23, 2012 17:59
Show Gist options
  • Save elijahr/3165026 to your computer and use it in GitHub Desktop.
Save elijahr/3165026 to your computer and use it in GitHub Desktop.
activate virtualenvs automatically
#### automatically activate virtualenvs named 'pyenv'
#### just put this at the end of your ~/.bashrc file
workon_virtualenv() {
if [ -e "${PWD}/pyenv" ]; then
deactivate >/dev/null 2>&1
source "${PWD}/pyenv/bin/activate"
fi
}
virtualenv_cd() {
cd "$@" && workon_virtualenv
}
alias cd="virtualenv_cd"
workon_virtualenv
#### /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment