-
-
Save benlubas/5b5e38ae27d9bb8b5c756d8371e238e6 to your computer and use it in GitHub Desktop.
Python 3 venv wrapper. Manages all virtual environments under ~/.virtualenvs/ .
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# include following in .bashrc / .bash_profile / .zshrc | |
# usage | |
# $ mkvenv myvirtualenv # creates venv under ~/.virtualenvs/ | |
# $ venv myvirtualenv # activates venv | |
# $ deactivate # deactivates venv | |
# $ rmvenv myvirtualenv # removes venv | |
export VENV_HOME="$HOME/.virtualenvs" | |
[[ -d $VENV_HOME ]] || mkdir $VENV_HOME | |
lsvenv() { | |
ls -1 $VENV_HOME | |
} | |
venv() { | |
if [ $# -eq 0 ] | |
then | |
echo "Please provide venv name" | |
else | |
source "$VENV_HOME/$1/bin/activate" | |
fi | |
} | |
mkvenv() { | |
if [ $# -eq 0 ] | |
then | |
echo "Please provide venv name" | |
else | |
python3 -m venv $VENV_HOME/$1 | |
fi | |
} | |
rmvenv() { | |
if [ $# -eq 0 ] | |
then | |
echo "Please provide venv name" | |
else | |
rm -r $VENV_HOME/$1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment