Skip to content

Instantly share code, notes, and snippets.

@altaurog
Created July 19, 2020 19:09
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 altaurog/f79c611555ad3af1797e6ff73e2fb7bb to your computer and use it in GitHub Desktop.
Save altaurog/f79c611555ad3af1797e6ff73e2fb7bb to your computer and use it in GitHub Desktop.
virtualenvwrapper bootstrap script
#!/bin/bash
mkdir ~/.venv
python3 -m venv ~/.virtualenvs/venv
~/.virtualenvs/venv/bin/pip install virtualenvwrapper
if [ -n "`$SHELL -c 'echo $ZSH_VERSION'`" ]; then
config=~/.zshrc
elif [ -n "`$SHELL -c 'echo $BASH_VERSION'`" ]; then
config=~/.bashrc
else
echo >&2 "preferred shell unknown: $SHELL"
exit 1
fi
VENVBIN="$HOME/.virtualenvs/venv/bin"
cat > $config <<EOF
export VIRTUALENVWRAPPER_PYTHON="$VENVBIN/python"
export VIRTUALENVWRAPPER_VIRTUALENV="$VENVBIN/virtualenv"
source "$VENVBIN/virtualenvwrapper.sh"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment