Skip to content

Instantly share code, notes, and snippets.

@step21
Forked from dbtek/venv_wrapper
Created May 3, 2019 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save step21/bd92eab922938843de7fa8f1862de0c7 to your computer and use it in GitHub Desktop.
Save step21/bd92eab922938843de7fa8f1862de0c7 to your computer and use it in GitHub Desktop.
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
}
lsvenv(){
ls $VENV_HOME
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment