Install python 2 on RHEL 8 / CentOS 8

The Python 2 interpreter is not available on RHEL 8 / CentOS 8 default installation. However, it can be installed with a single dnf command.

In this tutorial you will learn:

  • How to install Python 2 on RHEL 8 / CentOS 8.
  • How to to check Python version on RHEL 8 / CentOS 8.

Python 2 installation on Red Hat Enterprise Linux 8.

Python 2 installation on Red Hat Enterprise Linux 8.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System RHEL 8 / CentOS 8
Software Python 2
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install python 2 on RHEL 8 / CentOS 8 step by step instructions



  1. To install package Python 2 on RHEL 8 / CentOS 8 execute the following dnf command:
    # dnf install python2
    
  2. Use --version option to check the installed Python version. For example:
    # python2 --version
    Python 2.7.15