Chapter 2. Installing and using Python In RHEL 9, Python 3.9 is the default Python implementation. Since RHEL 9.2, Python 3.11 is available as the python3.11 package suite, and since RHEL 9.4, Python 3.12 as the python3.12 package suite. The unversioned python command points to the default Python 3.9 version. 2.1. Installing Python 3 The default Python implementation is usually installed by default. To install it manually, use the following procedure. Procedure To install Python 3.9 , use: To install Python 3.11 , use: To install Python 3.12 , use: Verification steps To verify the Python version installed on your system, use the --version option with the python command specific for your required version of Python . For Python 3.9 : For Python 3.11 : For Python 3.12 : 2.2. Installing additional Python 3 packages Packages prefixed with python3- contain add-on modules for the default Python 3.9 version. Packages prefixed with python3.11- contain add-on modules for Python 3.11 . Packages prefixed with python3.12- contain add-on modules for Python 3.12 . Procedure To install the Requests module for Python 3.9 , use: To install the pip package installer from Python 3.9 , use: To install the pip package installer from Python 3.11 , use: To install the pip package installer from Python 3.12 , use: Additional resources Upstream documentation about Python add-on modules 2.3. Installing additional Python 3 tools for developers Additional Python tools for developers are distributed mostly through the CodeReady Linux Builder (CRB) repository. The python3-pytest package and its dependencies are available in the AppStream repository. The CRB repository contains, for example, the following packages: python3*-idle python3*-debug python3*-Cython python3.11-pytest and its dependencies python3.12-pytest and its dependencies. Important The content in the CodeReady Linux Builder repository is unsupported by Red Hat. Note Not all upstream Python -related packages are available in RHEL. To install packages from the CRB repository, use the following procedure. Procedure Enable the CodeReady Linux Builder repository: Install the python3*-Cython package: For Python 3.9 : For Python 3.11 : For Python 3.12 : Additional resources How to enable and make use of content within CodeReady Linux Builder Package manifest 2.4. Using Python The following procedure contains examples of running the Python interpreter or Python -related commands. Prerequisites Ensure that Python is installed. If you want to download and install third-party applications for Python 3.11 or Python 3.12 , install the python3.11-pip or python3.12-pip package. Procedure To run the Python 3.9 interpreter or related commands, use, for example: To run the Python 3.11 interpreter or related commands, use, for example: To run the Python 3.12 interpreter or related commands, use, for example:

Commands:
dnf install python3
dnf install python3.11
dnf install python3.12
python3 --version
python3.11 --version
python3.12 --version
dnf install python3-requests
dnf install python3-pip
dnf install python3.11-pip
dnf install python3.12-pip
subscription-manager repos --enable codeready-builder-for-rhel-9-x86_64-rpms
dnf install python3-Cython
dnf install python3.11-Cython
dnf install python3.12-Cython
python3 python3 -m venv --help python3 -m pip install package pip3 install package
python3.11 python3.11 -m venv --help python3.11 -m pip install package pip3.11 install package
python3.12 python3.12 -m venv --help python3.12 -m pip install package pip3.12 install package