Skip to content

Instantly share code, notes, and snippets.

@alairock
Last active June 1, 2017 23:44
Show Gist options
  • Save alairock/e6b9539a6c7f1a50effcfa435c1cfe3f to your computer and use it in GitHub Desktop.
Save alairock/e6b9539a6c7f1a50effcfa435c1cfe3f to your computer and use it in GitHub Desktop.
Activate virtual environment (Assumes ./venv/bin/activate as activator)
cd(){
venvactifile=./venv/bin/activate
builtin cd "$@";
if [ -e "$venvactifile" ]; then
source $venvactifile
export PYTHONPATH=$(pwd)
echo "IN LIKE FLYNN"
else
if type deactivate >/dev/null 2>&1
then
deactivate
echo "Leaving Environment"
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment