Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 1. Installing and using 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.12 is the default Python implementation in RHEL 10. Python 3.12 is distributed in a non-modular python3 RPM package in the BaseOS repository and is usually installed by default. Python 3.12 will be supported for the whole life cycle of RHEL 10.

Additional versions of Python 3 will be distributed as non-modular RPM packages with a shorter life cycle through the AppStream repository in minor RHEL 10 releases. You will be able to install these additional Python 3 versions in parallel with Python 3.12.

The unversioned python command points to the default Python 3.12 version.

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. 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.12, enter:

    # dnf install python3
    Copy to Clipboard Toggle word wrap

Verification

  • Verify the Python version installed on your system:

    $ python3 --version
    Copy to Clipboard Toggle word wrap

1.3. Installing additional Python 3 packages

Packages prefixed with python3- contain add-on modules for the default Python 3.12 version.

Procedure

  • To install, for example, the Requests module for Python 3.12, enter:

    # dnf install python3-requests
    Copy to Clipboard Toggle word wrap
  • To install the pip package installer from Python 3.12, enter:

    # dnf install python3-pip
    Copy to Clipboard Toggle word wrap

1.4. Installing additional Python 3 tools for developers

Additional Python tools for developers are distributed through the CodeReady Linux Builder (CRB) repository.

Important

The content in the CodeReady Linux Builder repository is unsupported by Red Hat.

The CRB repository contains, for example, the following packages:

  • python3-pytest
  • python3-idle
  • python3-debug
  • python3-cython
Note

Not all upstream Python-related packages are available in RHEL.

Procedure

  1. Enable the CodeReady Linux Builder repository:

    # subscription-manager repos --enable codeready-builder-for-rhel-10-x86_64-rpms
    Copy to Clipboard Toggle word wrap
  2. Install, for example, the python3-cython package:

    # dnf install python3-cython
    Copy to Clipboard Toggle word wrap

1.5. Using Python

The following procedure contains examples of running the Python interpreter or Python-related commands.

Prerequisites

  • Python is installed.
  • If you want to download and install third-party applications, install the python3-pip package.

    Warning

    Installing Python packages with pip as the root user places files in system locations. This can override RHEL libraries and might cause system instability or conflicts with supported packages. Red Hat does not support software installed by using pip at the system level. To avoid these issues, use pip within a virtual environment or install packages as a non-root user with the --user option.

Procedure

  • To run the Python 3.12 interpreter or related commands, use, for example, the following commands:

    $ python3
    $ python3 -m venv --help
    $ python3 -m pip install <package>
    $ pip3 install <package>
    Copy to Clipboard Toggle word wrap
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2026 Red Hat
Retour au début