How to Install Pip on CentOS 7

By 

Updated on

3 min read

Install Python Pip on CentOS 7

Pip is a package management system that simplifies installation and management of software packages written in Python such as those found in the Python Package Index (PyPI). Pip is not installed by default on CentOS 7, but the installation is pretty simple.

In this tutorial, we will walk through the steps required to install Python pip on CentOS 7 using the yum package manager and cover the basics of how to install and manage Python packages with pip.

When installing python modules globally you should prefer to install distribution provided python modules using yum because they are tested to work properly on CentOS 7. Use pip to install python modules globally only if there is no rpm package for the python module.

In most cases, you should use pip inside a virtual environment only. Python Virtual Environments allows you to install Python modules in an isolated location for a specific project, rather than being installed globally. This way you do not have to worry about affecting other Python projects.

Prerequisites

Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges .

Installing pip on CentOS

To install pip on your CentOS machine, follow these steps:

1. Add the EPEL Repository

Pip is not available in CentOS 7 core repositories. To install pip we need to enable the EPEL repository :

Terminal
sudo yum install epel-release

2. Install pip

Once the EPEL repository is enabled we can install pip and all of its dependencies with the following command:

Terminal
sudo yum install python-pip

3. Verify Pip installation

To verify that the pip is installed correctly run the following command which will print the pip version:

Terminal
pip --version

The version number may vary, but it will look something like this:

output
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

Install development tools

Development tools are required for building Python modules, you can install them with:

Terminal
sudo yum install python-devel
sudo yum groupinstall 'development tools'

Managing Python Packages With PIP

In this section, we will go through a few useful basic pip commands. With pip, we can install packages from PyPI, version control, local projects and from distribution files. Usually, you will install packages from PyPI.

Let’s say we want to install a package named twisted, we can do that by issuing the following command:

Terminal
pip install twisted
Info
twisted is an asynchronous networking framework written in Python.

To uninstall a package run:

Terminal
pip uninstall twisted

To search packages from PyPI:

Terminal
pip search "twisted"

To list installed packages:

Terminal
pip list

To list outdated packages:

Terminal
pip list --outdated

Conclusion

You have successfully installed pip on your CentOS 7 system and you learned how to easily install and uninstall Python modules with pip. You can also check our guide about how How to install Python 3 with Pip 3 on CentOS 7 .

For more information about pip, check the pip user guide . If you have any questions or feedback, feel free to comment below.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page