Installing modern Python 3 releases on Ubuntu Linux without disturbing system Python dependencies is accomplished using the official deadsnakes PPA repository.

Deadsnakes PPA Installation Commands

Terminal Commandsbash
# Add deadsnakes PPA repository
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
 
# Install Python 3.12 and development headers
sudo apt install -y python3.12 python3.12-venv python3.12-dev
 
# Verify Python version
python3.12 --version