How to Install Python 3.11 or 3.12 on a Linux Computer
Below are the steps I followed to install both Python 3.11 and Python 3.12 in my Ubuntu Linux shell. Make sure to adjust your Python version to match 3.11 or 3.12 in all commands.
I downloaded the .tgz file from Python.org, not sure initially how to build Python from it. Once I unpacked the compressed files, I saw the build instructions in the README.rst to build a functional Python 3.11 on my Ubuntu computer. Here's how to install the speedier Python versions 3.11 or 3.12.
How to Install Python 3.11 or 3.12
Install Linux build libraries.
I followed this step posted on this blog. If you don't do this, you'll likely see an error about C not being found when running the ./configure command.
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev
Install sqllite Libraries (Django Requirement)
If you wish to make a Django website, install sqllite libraries before you build Python.
sudo apt install sqlite3 libsqlite3-dev
Use curl to download the Python gzip file.
curl https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz --output Python-3.11.0.tgz

Unpack gzip file to folder.
tar -xvzf Python-3.11.0.tgz
Change directory, read the README + find build commands.
cd Python-3.11.0
cat README.rst
Build Python.
# Build Python on Unix, Linux, BSD, macOS, and Cygwin: ./configure --enable-optimizations make make test sudo make install
Building Python on Various Platforms
This will install Python as python3.
You can pass many options to the configure script; run ./configure --help to find out more. On macOS case-insensitive file systems and on Cygwin, the executable is called python.exe; elsewhere it's just python.
Building a complete Python installation requires the use of various additional third-party libraries, depending on your build platform and configure options. Not all standard library modules are buildable or useable on all platforms. Refer to the Install dependencies section of the Developer Guide for current detailed information on dependencies for various Linux distributions and macOS.
On macOS, there are additional configure and build options related to macOS framework and universal builds. Refer to Mac/README.rst.
On Windows, see PCbuild/readme.txt.
- Python 3.11 Linux README.rst