Skip to content

Instantly share code, notes, and snippets.

@okken
Created March 26, 2021 00:05
Show Gist options
  • Select an option

  • Save okken/d166d194e1cb024d88540e8f75ac4b98 to your computer and use it in GitHub Desktop.

Select an option

Save okken/d166d194e1cb024d88540e8f75ac4b98 to your computer and use it in GitHub Desktop.
# stick this in .bashrc or .zshrc
# create, activate, exit
function create {
if [[ $# -gt 0 ]]
then
virtualenv -p py39 venv -q --prompt "($1) "
else
virtualenv -p py39 venv -q
fi
source venv/bin/activate
venv/bin/python -m pip install -U pip
}
function activate {
if [ -d venv ]
then
source venv/bin/activate
else
echo "not in a directory with a venv"
echo "try running create"
fi
}
function exit {
echo "deactivate"
deactivate
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment