Skip to content

Instantly share code, notes, and snippets.

@tom-doerr
Created March 3, 2020 19:20
Show Gist options
  • Save tom-doerr/41184ec7bcaf5f61d128d306361a8e79 to your computer and use it in GitHub Desktop.
Save tom-doerr/41184ec7bcaf5f61d128d306361a8e79 to your computer and use it in GitHub Desktop.
Bash function that activates a Python virtual environment and creates the environment if it doesn't yet exist
ve() {
if [[ ! $VIRTUAL_ENV ]]
then
if [ ! -d venv ]
then
virtualenv --no-site-packages venv
fi
source venv/bin/activate
else
deactivate
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment