pyenv
Chester Wyke August 19, 2022 Updated: September 01, 2025 #PythonCheck version of linux
uname -aInstall 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-devRun installer
Source: https://github.com/pyenv/pyenv-installer
curl https://pyenv.run | bashUpdate 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/#installing-python-versions-install
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>