Question: There is a need to install the pip software package in CentOS/RHEL. How to install the same?
For CentOS/RHEL 7
CentOS/RHEL 7 uses python 2.7 as the system version of python. Python 2.x is not maintained or supported since 2020, using it in applications is not recommended. Python 3 should be used whenever possible.
To install python 3 and python3-pip in CentOS/RHEL 7, use the command:
# yum install python3-pip
The command will install python3 if needed and pip3. Notice that the pip command is pip3 for Python 3. Also, invoke python as python3 to avoid confusion with the system version of python (2.7) which is present in OL7 because it is required by some system components.
For CentOS/RHEL 8
CentOS/RHEL 8 does not include python 2.x. The same installation method can be used to install python 3 and pip3:
# dnf install python3-pip
The command will install python3 if needed and pip3. Notice that the pip command is pip3 for Python 3.