07.06.2023

Install Python (latest version) on Ubuntu 20.04

What is a Python

Python is one of the most used programming language. The main advantages is relative simplicity, low learning curve, in-use versality, much third-parties designed plugins. Now this programming langage is popular for script-making, software producing, game development and even neuro-network learning. Python has cross-platform syntax and may be setup onto any actual operation system.

Method to get the newest Python

If recently developed Python is absolutely needed, you can face in-front of problem. The reason is update delay, Ubuntu repositories are not always contains the updated software versions. So, to get the most modern Python vervion please do:

apt install -y software-properties-common
apt-get update -y; apt upgrade -y

add-apt-repository -y ppa:deadsnakes/ppa

apt-get update && apt-cache search python3.1

apt-get install python3.11 -y

ln -s /usr/bin/python3.11 /usr/bin/python
python --version

Building from source code

If setup via pre-built package is impossible, you also have the way to build "fresh" Python from the codes. It's so simple, just do this:

apt-get -y update; apt -y install zlib1g-dev build-essential libgdbm-dev libncurses5-dev libssl-dev libnss3-dev libffi-dev libreadline-dev wget libsqlite3-dev libbz2-dev

mkdir /root/build
cd /root/build
wget <copied_URL>
tar -xf *.tgz

cd <python_version>

./configure --enable-optimizations

make -j $(nproc)

make altinstall

ln -s /usr/local/bin/python3.11 /usr/bin/python
python --version

Your work is finished, well done!

In a nutshell

Now you knew about Python, its advantages and scopes of using. Also you could install it from repository or via self-building.