Python is most popular programming language nowadays in the world.
By default RHEL/CentOS 8 doesn’t have an unversioned system-wide python command to avoid locking the users to a specific version of Python. Instead, it gives the user a choice to install, configure, and run a specific Python version. The system tools such as yum use an internal Python binary and libraries.
This guide will walk you through installing Python 3 and Python 2 on CentOS 8.
By default RHEL/CentOS 8 doesn’t have an unversioned system-wide python command to avoid locking the users to a specific version of Python. Instead, it gives the user a choice to install, configure, and run a specific Python version. The system tools such as yum use an internal Python binary and libraries.
This guide will walk you through installing Python 3 and Python 2 on CentOS 8.
Installing Python 3 on CentOS 8 / RedHat 8
Enter following command to install Python3
$ sudo dnf install python3 verify python version $ python3 --version Python 3.6.8
Installing Python 2 on CentOS 8 / RedHat 8
Enter the following command to install Python2$ sudo dnf install python2 verify python version $ python2 --version Python 2.7.16
Set Default Python version
Use alternatives command to set default python versionFor Python version 3
$ sudo alternatives --set python /usr/bin/python3
For Python Version 2
$ sudo alternatives --set python /usr/bin/python2
No comments:
Post a Comment