The latest CentOS 8 or Stream based on Redhat 8 features the Python 3.8 as an installation candidate in its official repository. Here we will see the process of installing Pip and Python using command terminal.
About Python, it is an open-source high-level programming language with multiple programming paradigms and functional programming support.
Add Python 3.6 to RHEL 8/CentOS 8/Stream
The standard repository for RHEL 8.0 provides Python 3.6. It can be installed using the dnf or yum command. However, we are going to use the dnf because it is the future of package manager of theses Linux OS.
sudo dnf install python36
Press Y key to accept the download and installation.
The output for the above command:
[root@localhost ~]# dnf install python36 Last metadata expiration check: 0:07:01 ago on Sun 29 Sep 2019 12:11:09 AM EDT. Dependencies resolved. ============================================================================================================== Package Arch Version Repository Size ============================================================================================================== Installing: python36 x86_64 3.6.8-2.module_el8.0.0+33+0a10c0e1 AppStream 19 k Installing dependencies: python3-pip noarch 9.0.3-13.el8 AppStream 18 k python3-setuptools noarch 39.2.0-4.el8 BaseOS 162 k Transaction Summary ============================================================================================================== Install 3 Packages Total download size: 200 k Installed size: 466 k Is this ok [y/N]:

Check CentOS 8 installed python version
Python 3.6 is installed. Now check the version using below given command. If you cannot find the command to check the version, I mean it doesn’t work then simply update the system using dnf update and logout and login again.
python3 --version
or
python3.6 --version

The output will be:
Python 3.6.8
Change Python3 command to the Python only
Let’s set default python to python3 on CentOS 8: It could be a little bit intricate for some to type python3 command to use. Since we have installed Python3.6.By default, Python3 is the command available to use, so here we change and set Python command as its alternative which can be executed with another syntax in a single command.
sudo alternatives --config python or sudo update-alternatives --config python
What we are doing here, we configuring and assigning initial syntax of this language command that is Python to python3.
When you run the above command list of all installed Python on your system will appear. Here we have only one that is 3.6, so we got that.
Just type a serial number of the version you want to use.
So, enter the number on the left side of Python 3 (here it is 2) and press Enter button to complete the setting…
Output
There are 2 programs which provide 'python'. Selection Command ----------------------------------------------- *+ 1 /usr/libexec/no-python 2 /usr/bin/python3 Enter to keep the current selection[+], or type selection number: 2

Now it is possible to execute Python commands alone. Use it alone to check the installed version on CentOS/Stream or RHEL 8.
python --version

In the same way, set default pip to pip3
Like Python commands, we can change pip3 command to be pip to use its initial form without any version figure.
Check the PIP version using pip3 command:
pip3 --version
or
pip3.6 --version

However, the command to set alternative is a little bit different here, instead of created any symbolic link we just make the PIP command as an alias of pip3. Thus, when we type pip in the background the default pip3 command will execute.
alias pip=pip3
With the above settings, pip
commands can now be called alone.
pip --version
The output of the above command
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

Summary of Python setup
Here we have successfully explained how to install Python 3.6 on RHEL 8 / CentOS 8. Also, in the 8 series OS, the use of Python 3 series is recommended.
When using different versions of Python, you can use the alternatives command to switch versions (symbolic links) or alias as shown above for Python 2 or PiP 2 and more.
Other Articles:
- How to install Node.JS & NPM on Docker
- Commands to install rpm packages on CentOS or Redhat Linux
- Install Kloxo-MR free VPS host Cpanel on CentOS 7/Redhat
Related Posts
How to Reset Visual Code Studio Completely on Windows 10 or 11
Adding Visual Studio Code to the System Path in Windows 11 or 10
Finding Visual Studio Code Version on Windows 11 or 10
Running PHP Files in Visual Studio Code with XAMPP: A Step-by-Step Guide
How to do a scatter plot in Google Sheets? Easily represents the correlation between numerical values
Multiple Methods to Verify Python Installation on Windows 11