Upgrade Python Linux Jun 2026
# Debian/Ubuntu sudo apt update sudo apt install -y build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev curl \ libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
sudo dnf groupinstall -y "Development Tools" sudo dnf install -y openssl-devel bzip2-devel libffi-devel readline-devel sqlite-devel upgrade python linux
python --version
To avoid breaking system-level tools, always create a virtual environment when starting a new project with your upgraded Python version. # Debian/Ubuntu sudo apt update sudo apt install
| Issue | Solution | |-------|----------| | pip not found for new Python | Run python3.12 -m ensurepip | | SSL module missing | Install libssl-dev / openssl-devel and recompile | | make fails with _ctypes | Install libffi-dev and recompile | | altinstall still overwrites python3 ? | Manually check /usr/bin/python3 – should still point to system version | upgrade python linux