What is Python?
Python is a versatile, interpreted, object-oriented, high-level programming language with dynamic semantics. It offers high-level built-in data structures and utilizes dynamic typing and dynamic binding, making it extremely appealing for quick application development. Additionally, it is often used as a scripting or glue language to connect different existing components.
Install Python
To install Python from its source code, we will need to build, compile it and then proceed with the installation process. Once Python is successfully installed, it is crucial to verify the installation by checking its version. For further information and detailed instructions, please refer to the official Python documentation.
Linux (RPM)
You can use the following commands to install Python in RPM-based Linux operating systems such as CentOS Linux, Red Hat Linux, Fedora Linux, Amazon Linux, Alma Linux, Rocky Linux, etc., or any other similar equivalents.
# Install Python.
$ sudo yum install python3.12
# Set Python 3.12 as default interpreter and Python 3.9 as fallback interpreter.
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 2
# List Python versions.
$ sudo update-alternatives --list python
# Check Python version.
$ python --version
Linux (Debian)
You can use the following commands to install Python in Debian-based Linux operating systems such as Ubuntu Linux, Mint Linux, Kali Linux, Kubuntu Linux, etc., or any other similar equivalents.
# Install Python.
$ sudo apt install python3.12
# Set Python 3.12 as default interpreter.
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
# List Python versions.
$ sudo update-alternatives --list python
# Check Python version.
$ python --version