Red Hat Enterprise Linux 8 (RHEL 8) comes with Python 3 installed by default. However, if you need to install a specific version of Python 2, you can use the yum
package manager to do so.
To install Python 2.7 using yum
, you can use the following command:
sudo yum install python2
This command will install the latest version of Python 2 available in the default package repositories.
If you want to install a specific version of Python 2, you can use the following command:
sudo yum install python2-<version>
For example, to install Python 2.7.18, the command would be:
sudo yum install python2-2.7.18-1.el8
It’s worth noting that, if you install a different version of python2, it may not be the system python, which is python3. So, to use that version of python you may need to use the full path to the python binary or set an alias.
Also, keep in mind that Red Hat Enterprise Linux 8 has reached its end of support, so it is recommended to use a newer version of the operating system or a different Linux distribution if possible.