CentOS 8
Sponsored Link

Python 2.7 : Install2019/12/12

 
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                               Repository
                                                                           Size
================================================================================
Installing group/module packages:
 python2           x86_64 2.7.15-24.module_el8.0.0+193+7850e68f AppStream 107 k
 python2-libs      x86_64 2.7.15-24.module_el8.0.0+193+7850e68f AppStream 6.0 M
 python2-pip       noarch 9.0.3-13.module_el8.0.0+32+017b2cba   AppStream 2.0 M
 python2-setuptools
                   noarch 39.0.1-11.module_el8.0.0+32+017b2cba  AppStream 643 k
Installing module profiles:
 python27/common
Enabling module streams:
 python27                 2.7

Transaction Summary
================================================================================
Install  4 Packages
.....
.....

[root@dlp ~]#
python2 -V

Python 2.7.15

# 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.15 (default, Oct 8 2019, 21:08:29)
[GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]
[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.15
Matched Content