Chapter 1. Introduction to Python

Python is a high-level programming language that supports multiple programming paradigms, such as object-oriented, imperative, functional, and procedural paradigms. Python has dynamic semantics and can be used for general-purpose programming.

With Red Hat Enterprise Linux, many packages that are installed on the system, such as packages providing system tools, tools for data analysis, or web applications, are written in Python. To use these packages, you must have the python* packages installed.

1.1. Python versions

Python 3.9 is the default Python implementation in RHEL 9. Python 3.9 is distributed in a non-modular python3 RPM package in the BaseOS repository and is usually installed by default. Python 3.9 will be supported for the whole life cycle of RHEL 9.

Additional versions of Python 3 are distributed as non-modular RPM packages with a shorter life cycle through the AppStream repository in minor RHEL 9 releases. You can install these additional Python 3 versions in parallel with Python 3.9.

Python 2 is not distributed with RHEL 9.

Table 1.1. Python versions in RHEL 9

VersionPackage to installCommand examplesAvailable sinceLife cycle

Python 3.9

python3

python3, pip3

RHEL 9.0

full RHEL 9

Python 3.11

python3.11

python3.11, pip3.11

RHEL 9.2

shorter

For details about the length of support, see Red Hat Enterprise Linux Life Cycle and Red Hat Enterprise Linux Application Streams Life Cycle.

1.2. Major differences in the Python ecosystem since RHEL 8

The following are the major changes in the Python ecosystem in RHEL 9 compared to RHEL 8:

The unversioned python command

The unversioned form of the python command (/usr/bin/python) is available in the python-unversioned-command package. On some systems, this package is not installed by default. To install the unversioned form of the python command manually, use the dnf install /usr/bin/python command.

In RHEL 9, the unversioned form of the python command points to the default Python 3.9 version and it is an equivalent to the python3 and python3.9 commands. In RHEL 9, you cannot configure the unversioned command to point to a different version than Python 3.9.

The python command is intended for interactive sessions. In production, it is recommended to use python3, python3.9, or python3.11 explicitly.

You can uninstall the unversioned python command by using the dnf remove /usr/bin/python command.

If you need a different python or python3 command, you can create custom symlinks in /usr/local/bin or ~/.local/bin, or use a Python virtual environment.

Several other unversioned commands are available, such as /usr/bin/pip in the python3-pip package. In RHEL 9, all unversioned commands point to the default Python 3.9 version.

Architecture-specific Python wheels

Architecture-specific Python wheels built on RHEL 9 newly adhere to the upstream architecture naming, which allows customers to build their Python wheels on RHEL 9 and install them on non-RHEL systems. Python wheels built on previous releases of RHEL are compatible with later versions and can be installed on RHEL 9. Note that this affects only wheels containing Python extensions, which are built for each architecture, not Python wheels with pure Python code, which is not architecture-specific.