Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Python 3 venv wrapper. Manages all virtual environments under ~/.venv/ .
# include following in .bashrc / .bash_profile / .zshrc
# usage
# $ mkvenv myvirtualenv # creates venv under ~/.venv/
# $ venv myvirtualenv # activates venv
# $ deactivate # deactivates venv
# $ rmvenv myvirtualenv # removes venv
export VENV_HOME="$HOME/.venv"
[[ -d $VENV_HOME ]] || mkdir $VENV_HOME
venv() {
source "$VENV_HOME/$1/bin/activate"
}
mkvenv() {
python3 -m venv $VENV_HOME/$1
}
rmvenv() {
rm -r $VENV_HOME/$1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment