PIP is a recursive acronym that stands for “PIP Installs Python” (Confusing, right ?). PIP is basically a package manager to manage python-based applications & packages. PIP is used to install, remove or upgrade many of the python packages available in a repository known as Python Package Index or PyPI, in short.
Think PIP as YUM or APT for Python packages. In this tutorial, we will learn to install PIP on CentOS machines. Let’s discuss pre-requisites first.
Pre-requisites
To install the latest version of Python 3 on your system, please refer to the detailed article HERE.
Also read: How to uninstall Python from Windows, Linux & MacOS
Install PIP3 on CentOS
Once we have required python 3 version installed (we installed python 3.7 installed on our system using the above-mentioned tutorial), we can then proceed to install the respective PIP version on our system, which will be ‘python37-pip’ for us.
To install PIP3, we need to first install the EPEL repository on our system first (detailed tutorial HERE) & then install PIP3 using yum from the EPEL repository. Commands to install EPEL repository are mentioned below,
RHEL/CentOS 8
# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
RHEL/CentOS 7
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
RHEL/CentOS 6 (64 Bit)
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RHEL/CentOS 6 (32 Bit)
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Now that we have EPEL repo installed on our system, we can execute the following command to install PIP3 on CentOS,
# yum install python37-pip
That’s it, Python PIP3 is installed on our system. Let’s discuss some of the PIP3 commands that we can use to manage the python packages.
PIP commands
To install a package using PIP, use the following command,
# pip3 install package_name
To install a number of packages, we can create a file & mention all the packages we need to have to install ed on our system. Then run the following command to install all the packages,
# pip3 install -r packages.txt
To remove a package, run
# pip3 uninstall package_name
Command to only download a package & not install it is,
# pip3 download package_name
To list installed packages,
# pip3 list
For a complete list of options that can be used with PIP command, run
# pip3 –help
That’s it for this tutorial on how to install PIP3 on CentOS. Please feel free to send in any questions or queries using the comment box below.
CentOS 6 – No package python37-pip available.