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 Copy linkLink copied to clipboard!
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.
| Version | Package to install | Command examples | Available since | Life cycle |
|---|---|---|---|---|
| Python 3.9 |
|
| RHEL 9.0 | full RHEL 9 |
| Python 3.11 |
|
| RHEL 9.2 | shorter |
| Python 3.12 |
|
| RHEL 9.4 | 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 Copy linkLink copied to clipboard!
RHEL 9 introduces several major changes in the Python ecosystem compared to RHEL 8, including the unversioned python command and architecture-specific Python wheels.
- The unversioned
pythoncommand -
The unversioned form of the
pythoncommand (/usr/bin/python) is available in thepython-unversioned-commandpackage. On some systems, this package is not installed by default. To install the unversioned form of thepythoncommand manually, use thednf install /usr/bin/pythoncommand.
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, python3.11, or python3.12 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
wheelsbuilt on RHEL 9 newly adhere to the upstream architecture naming, which allows customers to build their Pythonwheelson RHEL 9 and install them on non-RHEL systems. Pythonwheelsbuilt on previous releases of RHEL are compatible with later versions and can be installed on RHEL 9. Note that this affects onlywheelscontaining Python extensions, which are built for each architecture, not Pythonwheelswith pure Python code, which is not architecture-specific.