Skip to main content

Ubuntu 20.04 comes with Python 3.8 installed.  If you run the update script, you'll be informed that the latest version of Python is running.  But here is the kicker, the actual latest version is currently 3.11.6... see https://www.python.org/downloads/source/

Use the following commands to download the Python 3.11.6 source code

 

Download the latest version

cd /usr/src 
sudo wget https://www.python.org/ftp/python/3.11.6/Python-3.11.6.tgz 

 

Extract archive

Once the download is finished, extract the archive file content.

sudo tar xzf Python-3.11.6.tgz 

Prepare the source code as per your system architecture and environment. Also, we'll use --enable-optimizations option with configure command to enable additional supports like SSL, bz2 support.

cd Python-3.11.6
sudo ./configure --enable-optimizations

 

Compile and install

Now it's time to compile using the make command.  We are using make altinstall, to install it as a separate Python.  Therefore, this will not overwrite the existing Python installation.

sudo make altinstall

 

Check Python Version

Run the following command to check the version

python3.11 -V

Response

Python 3.11.6

 

Installing PIP

PIP will not be installed by default if you used the package manager.  If this is the case, install it manually.  To install PIP, execute the following command

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11

Once the PIP is installed successfully, check its version by executing the command:

pip3.11 -V

Response

pip 22.3.1 from /usr/local/lib/python3.11/dist-packages/pip (python 3.11)

 

Related articles

Andrew Fletcher18 Mar 2024
Resolving CVE-2022-48624 less issue
To resolve the CVE-2022-48624 vulnerability on Ubuntu using Nginx, it's crucial to understand that the issue lies within the "less" package, not Nginx itself. The vulnerability affects "less" before version 606, where close_altfile in filename.c in less omits shell_quote calls for LESSCLOSE,...