How to Install Python 3 and Python 2 on CentOS 8

Python is one of the most popular programming languages in the world. With its simple and easy-to-learn syntax, Python is a popular choice for beginners and experienced developers alike.

Unlike other Linux distributions, Python is not installed by default on CentOS 8.

1.Cài đặt Python 3 trên CentOS 8

To install Python 3 on CentOS 8, run the following command as root or sudo user:

# dnf install python3
 

Check python version by typing:

# python3 --version
 

2.Cài đặt Python 2 trên CentOS 8

To install Python 2, enter the following command:

 
# dnf install python2
Check python version by typing:
# dnf install python2