Installing Python from Source

To get the latest version, visit the official Python web site:

https://www.python.org/downloads/

Install the packages needed for compiling Python. On Fedora:

sudo dnf install gcc make openssl-devel bzip2-devel libffi-devel zlib-devel sqlite-devel xz-devel readline-devel ncurses-devel gdbm-devel tk-devel libuuid-devel

Or on Debian:

sudo apt install build-essential libssl-dev libbz2-dev libffi-dev zlib1g-dev libsqlite3-dev liblzma-dev libreadline-dev libncurses-dev libgdbm-dev tk-dev uuid-dev

Then download and extract the Python source, for example Python 3.14.10:

mkdir -p ~/Python && cd ~/Python
curl -LO https://www.python.org/ftp/python/3.14.10/Python-3.14.10.tar.xz
tar -xvf Python-3.14.10.tar.xz
cd Python-3.14.10

Run the configuration script to prepare the build. Run it as your normal user, not with sudo: only the final install needs root.

./configure --enable-optimizations --with-lto --enable-loadable-sqlite-extensions

--enable-optimizations and --with-lto make Python faster, at the cost of a longer build. Now build it; the -j flag uses all your processor cores:

make -j $(nproc)

Finally, install it alongside the system Python using altinstall, which doesn’t overwrite the python3 command your system relies on:

sudo make altinstall

All being well, you now have two versions of Python available: the system’s own python3, whatever version your distribution ships, and the one you just installed, under its version name:

python3.14 -V
Python 3.14.10

Use it to create virtual environments for your projects, for example python3.14 -m venv venv.

tip

If sudo says user is not in the sudoers file, add your user to the administrators’ group as root: usermod -aG wheel <username> on Fedora, or usermod -aG sudo <username> on Debian, then log in again.