Install Python 2 Engine on CentOS

This section provides a tutorial example on how to install Python 2 engine to run old Python scripts and applications on CentOS systems.

If you still have some old Python scripts written in Python 2 language, you need to following this tutorial to install the module.

1. Check for Python 2 packages:

herong$ dnf search python2

python2.x86_64 : An interpreted, interactive, object-oriented programming language
python2-jinja2.noarch : General purpose template engine for python2
python2-test.x86_64 : The test modules from the main python2 package
python2-docutils.noarch : System for processing plaintext documentation for python2
python2-urllib3.noarch : Python2 HTTP library with thread-safe connection pooling and file post
...

2. Install Python 2:

herong$ sudo dnf install python2

...
Installed:
  python2-2.7.16-12.module_el8.1.0+219+cf9e6ac9.x86_64
  python2-pip-9.0.3-14.module_el8.1.0+219+cf9e6ac9.noarch
  python2-setuptools-39.0.1-11.module_el8.1.0+219+cf9e6ac9.noarch
  python2-libs-2.7.16-12.module_el8.1.0+219+cf9e6ac9.x86_64
  python2-pip-wheel-9.0.3-14.module_el8.1.0+219+cf9e6ac9.noarch
  python2-setuptools-wheel-39.0.1-11.module_el8.1.0+219+cf9e6ac9.noarch

Complete!

3. Verify Python 2 installation:

herong$ python2

Python 2.7.16 (default, Nov 17 2019, 00:07:27)
[GCC 8.3.1 20190507 (Red Hat 8.3.1-4)] on linux2
>>> <Ctrl-D>

herong$ pip2 --version
pip 9.0.3 from /usr/lib/python2.7/site-packages (python 2.7)

Cool. I have Python 2 engine and package installer installed and ready to run any Python 2 scripts.

Table of Contents

 About This Book

 Introduction to Linux Systems

 Process Management

 Files and Directories

 Running Apache HTTP Server (httpd) on Linux Systems

 Running Apache Tomcat on Linux Systems

 Running PHP Scripts on Linux Systems

 Running MySQL Database Server on Linux Systems

Running Python Scripts on Linux Systems

 Install and Manage Python Engine on CentOS

 "pip/pip3" Python Package Manager

 Install MySQL Connector/Python on CentOS

Install Python 2 Engine on CentOS

 Conda - Environment and Package Manager

 GCC - C/C++ Compiler

 OpenJDK - Open-Source JDK

 Graphics Environments on Linux

 SquirrelMail - Webmail in PHP

 Tools and Utilities

 References

 Full Version in PDF/EPUB