Python Update Linux Repack May 2026

python3.12 my_script.py Or use update-alternatives (Debian/Ubuntu):

ls /usr/bin/python* /usr/local/bin/python* ~/.pyenv/versions/ 2>/dev/null Switch temporarily: python update linux

apt list -a python3 If you need a newer version than the repo provides, use a (Ubuntu) or deadsnakes : python3

python3.12 --version Version managers let you install multiple Python versions per user without sudo . pyenv (Most popular) # Install pyenv curl https://pyenv.run | bash Add to ~/.bashrc echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(pyenv init -)"' >> ~/.bashrc source ~/.bashrc Install a new Python version pyenv install 3.12.2 pyenv global 3.12.2 # set as default for your user conda / miniconda Great for data science and isolated environments. Check all installed Python versions: python3

sudo rm -rf /usr/bin/python3 sudo ln -s /usr/local/bin/python3.12 /usr/bin/python3 This breaks apt , gnome-terminal , software-properties-gtk , and many other system tools. Check all installed Python versions:

python3.12 -m venv myprojectenv source myprojectenv/bin/activate | Issue | Solution | |--------|----------| | ModuleNotFoundError: No module named 'distutils' | Install python3.12-distutils or python3-distutils from your package manager | | pip not found after source install | Run python3.12 -m ensurepip or python3.12 -m pip install --upgrade pip | | System Python broken | Boot from live USB, chroot, and reinstall the original Python version via package manager | | ssl module missing after source compile | Install libssl-dev / openssl-devel and recompile Python | Summary Table: Best Update Method by Use Case | Use Case | Recommended Method | |----------|--------------------| | Keep system secure, don't need latest features | sudo apt upgrade python3 (package manager) | | Need a specific newer version not in repos | deadsnakes PPA (Ubuntu) / EPEL (RHEL) | | Need absolute latest patch release | Compile from source with altinstall | | Development with multiple Python versions | pyenv | | Data science / ML projects | conda | Final advice: Never replace your system’s default Python 3. Instead, install additional versions alongside it and use virtual environments or version managers to keep your projects isolated.