Skip to content

Instantly share code, notes, and snippets.

@btorresgil
Last active February 3, 2020 22:54
Show Gist options
  • Save btorresgil/5160a9d633c04222a33f43c0fa4a986f to your computer and use it in GitHub Desktop.
Save btorresgil/5160a9d633c04222a33f43c0fa4a986f to your computer and use it in GitHub Desktop.
Shell environment for python
### These next lines were added in the steps above
# pyenv
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
# pipx
export PATH="~/.local/bin:$PATH"
# poetry
export PATH="$HOME/.poetry/bin:$PATH"
### Add these next lines to protect your system python from
### polution from 3rd-party packages
# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
# commands to override pip restriction above.
# use `gpip` or `gpip3` to force installation of
# a package in the global python environment
# Never do this! It is just an escape hatch.
gpip(){
PIP_REQUIRE_VIRTUALENV="" pip "$@"
}
gpip3(){
PIP_REQUIRE_VIRTUALENV="" pip3 "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment