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 the repository known as Python Package Index or PyPI, in short.
Recommended Read: Install Python on Ubuntu : A Simple guide
Think PIP as YUM or APT for Python packages. In this tutorial, we will learn to install PIP on CentOS machines. Let’s discuss about pre-requisites first,
We should have Python installed on our system, which most of the Linux systems already have installed by default. But we can install python on Centos with the following command as well,
# yum install python
You can also refer to our detailed tutorial here for python installation. Now next step would be to discuss how to install PIP on CentOS.
Install PIP on CentOS
We can either of the two below mentioned methods to install PIP on CentOS. We can either install PIP using a script or we can use EPEL repository maintained PIP package on our system.
Install using script
There is an official script that we can use to install PIP on centos, we just need to download it & run it on our system,
# curl “https://bootstrap.pypa.io/get-pip.py” -o “get-pip.py”
# python get-pip.py
Upon completion of our script, we would have PIP installed on our system.
Install using EPEL repository
For this method, we need to first install the EPEL repository on our system (detailed tutorial HERE) & then install PIP using yum from EPEL repository. To install EPEL repository, use one the following command (based on your CentOS version),
# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# 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
Once we have EPEL repository installed on our system, execute the following command to install PIP on CentOS,
# yum install python-pip
That’s it, Python PIP is installed on our system. Let’s discuss some of the PIP commands that we can use to manage the python packages.
To install a package using PIP, use the following command,
# pip 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,
# pip install -r packages.txt
To remove a package, run
# pip uninstall package_name
Command to only download a package & not install it is,
# pip download package_name
To list installed packages,
# pip list
For a complete list of options that can be used with PIP command, run
# pip –help
That’s it for this tutorial on how to install PIP on CentOS. Please feel free to send in any questions or queries using the comment box below.