Skip to content

Instantly share code, notes, and snippets.

@valyagolev
Created August 18, 2011 19:33
Show Gist options
  • Save valyagolev/1154951 to your computer and use it in GitHub Desktop.
Save valyagolev/1154951 to your computer and use it in GitHub Desktop.
Virtualenv in new Terminal windows/tabs

Run these commands in your console, they will edit necessary files:

echo 'basename "$VIRTUAL_ENV" > ~/.last_venv' >> $VIRTUALENVWRAPPER_HOOK_DIR/postactivate
echo 'rm ~/.last_venv' >> $VIRTUALENVWRAPPER_HOOK_DIR/postdeactivate

Then open your ~/.bashrc or ~/.profile or whatever your shell uses and append:

if [ -e ~/.last_venv ]; then
    workon `cat ~/.last_venv`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment