Python pyenv

From wikinotes

Tool that manages/installs (non-system) python installs, and allows you to set which 'python' is being used.
Technically, it only supports the unixes, but it was ported to windows in python pyenv-win.

See also nix and direnv, which produce similar results managing multiple languages.

Documentation

github https://github.com/pyenv/pyenv

Install

sudo pacman -S pyenv

Configuration

# add to ~/.zshrc
eval "$(pyenv init -)"

Usage

pyenv init                    # initialize your shell to use penv
pyenv install    3.6.5        # install python 3.6.5
pyenv install -g 3.8.0        # install python 3.8.0 w/ gdb debug symbols

pyenv local 3.6.5             # 'python' command now uses 3.6.5
env PYENV_VERSION=system vim  # use specific pyenv version

pyenv versions                # list installed versions
penv version                  # info about selected version

Extensions

python pyenv-virtualenv automatically activate a virtualenv