Member-only story
Install Python 3.12 on Ubuntu
In this short article, we’ll install Python 3.12 on Ubuntu by building the Python source code! These same steps apply if you want to install Python 3.12 on WSL 2.0 running Ubuntu, install Python 3.12 on Ubuntu 20.04, or install Python 3.12 on Ubuntu 22.04.
There is a free companion video available at:
Install Build Dependencies
We’ll start by opening the terminal and updating our current software.
sudo apt update && sudo apt upgrade -yThen display the version of Python by running:
python3 — versionYou probably have Python 3.8 on Ubuntu 20.04 or Python 3.10 or Ubuntu 22.04. Note that we are not going to modify this version. It is important that we don’t uninstall, remove, or change the default system install of Python. Instead, we’ll install the latest version of Python along side the default installation.
To build Python from source, we’ll require the following dependencies:
sudo apt-get install build-essential gdb lcov pkg-config \
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \…








