Skip to content

Instantly share code, notes, and snippets.

@serpro69
Created July 14, 2023 18:43
Show Gist options
  • Save serpro69/c876870c84cc1c1082fac1d472024648 to your computer and use it in GitHub Desktop.
Save serpro69/c876870c84cc1c1082fac1d472024648 to your computer and use it in GitHub Desktop.
python+virtualenv
#!/usr/bin/env bash
# TODO convert to a role in https://github.com/serpro69/ansible-collection-devexp
# installs https://virtualenv.pypa.io/en/latest/index.html
# requires pipx - https://pypi.org/project/pipx/
# pipx install virtualenv
# pip install --user --no-deps virtualenvwrapper # use no-deps to skip installing virtualenv via pip since it's installed via pipx
# export
pip install --user virtualenv virtualenvwrapper
if virtualenv --help >/dev/null 2>&1 && [ -f $HOME/.local/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=$(readlink -f $(which virtualenv))
source "$HOME/.local/bin/virtualenvwrapper.sh"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment