-
-
Save richardkiss/cbc0b6fbc8518083812bfcdf7e11c4c7 to your computer and use it in GitHub Desktop.
A nice shell script to put all your venvs in the same place
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
#!/bin/sh | |
VENV_PATH=${@:-${VENV_BASE_PATH:-~/tmp/virtualenvs}}/`pwd | sed "s|/|_|g"`/venv | |
if [ -e $VENV_PATH ] | |
then | |
echo rm -rf $VENV_PATH | |
echo and try again | |
else | |
mkdir -p $VENV_PATH | |
echo building venv at $VENV_PATH | |
python3 -m venv $VENV_PATH | |
if [ -L activate ] | |
then | |
rm activate | |
fi | |
. $VENV_PATH/bin/activate | |
python -m pip install --upgrade pip | |
ln -s $VENV_PATH/bin/activate | |
echo now do \`source activate\` | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment