pyenv
Check version of linux 🔗
uname -a
Install prerequisites 🔗
Source: https://github.com/pyenv/pyenv/wiki
sudo apt update && sudo apt install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
Run installer 🔗
Source: https://github.com/pyenv/pyenv-installer
curl https://pyenv.run | bash
Update bashrc 🔗
Add the following lines to bashrc
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
List versions available for install 🔗
Source: https://realpython.com/intro-to-pyenv/#using-pyenv-to-install-python
Can also be filtered with grep like in the example
pyenv install --list | grep " 3\.[678]"
Install new version 🔗
Source: https://github.com/pyenv/pyenv#usage
pyenv install <version>