Rocky_Linux_8
Sponsored Link

Python 2.7 : Install2021/08/02

 
Install Python 2.7.
[1] It's possible to install Python 2.7 from AppStream.
[root@dlp ~]#
dnf module -y install python27

Dependencies resolved.
==========================================================================================
 Package                    Arch    Version                               Repo        Size
==========================================================================================
Installing group/module packages:
 python2                    x86_64  2.7.18-4.module+el8.4.0+403+9ae17a31  appstream  108 k
 python2-libs               x86_64  2.7.18-4.module+el8.4.0+403+9ae17a31  appstream  6.0 M
 python2-pip                noarch  9.0.3-18.module+el8.4.0+403+9ae17a31  appstream  1.7 M
 python2-setuptools         noarch  39.0.1-13.module+el8.4.0+403+9ae17a31 appstream  641 k
Installing dependencies:
 python2-pip-wheel          noarch  9.0.3-18.module+el8.4.0+403+9ae17a31  appstream  1.0 M
 python2-setuptools-wheel   noarch  39.0.1-13.module+el8.4.0+403+9ae17a31 appstream  286 k
Installing module profiles:
 python27/common
Enabling module streams:
 python27                           2.7

Transaction Summary
==========================================================================================
Install  6 Packages
.....
.....

[root@dlp ~]#
python2 -V

Python 2.7.18

# verify to create test script

[root@dlp ~]#
echo -e "import sys\nprint(sys.version)" > python2_test.py

[root@dlp ~]#
python2 python2_test.py

2.7.18 (default, May 30 2021, 19:42:58)
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
[2] If you'd like to use [python] command which does not have version number, it's possible to switch them with [alternatives].
[root@dlp ~]#
alternatives --config python

There are 3 programs which provide 'python'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/libexec/no-python
   2           /usr/bin/python3
   3           /usr/bin/python2

Enter to keep the current selection[+], or type selection number: 3

[root@dlp ~]#
python -V

Python 2.7.18
Matched Content