pyenv
Install
Run
curl https://pyenv.run | bash
Add to ~/.bashrc
vim ~/.bashrc
vim ~/.zshrc
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
Commands
# List python versions available
pyenv install --list
# Install specific version
pyenv install -v 3.6.15
pyenv install -v 3.9
pyenv install -v 3.10
# pyenv install -v 2.7.18
# List versions installed
ls ~/.pyenv/versions/
# Switch forever to pyenv
pyenv global 3.6.15
pyenv global 3.9
pyenv global 3.10
# pyenv global -v 2.7.18
# Switch temporary python version
pyenv shell 3.9
# pyenv shell 2.7.18
# Switch directory python version
pyenv local 2.7.15
Sources
- https://realpython.com/intro-to-pyenv/ ^10xmhp3mc4v7
- https://github.com/pyenv/pyenv/wiki/Common-build-problems