Ubuntu 24.04 already includes Python 3.12 — here's the clean, modern way to set up your Python environment.
python3 --version
# Expected: Python 3.12.x (e.g. 3.12.3)
ls /usr/bin/python*
python3 -m pip --version
sudo apt update
sudo apt install -y python3-pip python3-venv python3-dev python-is-python3
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools wheel
Python 3.12 remains excellent, stable, and very well supported on Ubuntu 24.04.