How To Install Python Pip On CentOS 7

Introduction

Pip is a robust package management system designed to simplify the installation and management of all software packages compiled in Python. CentOS 7 doesn't come with a pre-installed pip application, but you can easily install it from the command line.

One of the best and simplest way to install this package is to install distribution-provided Python pip modules using yum. The modules provided for distribution are authenticated and should work flawlessly with CentOS 7.

However, if there is no rpm package for the available modules you can utilize pip to install and configure python modules globally.

This tutorial will help you install and configure pip on using the yum package manager on CentOS 7.

Ready? Let's get started!

Step 1 Installing pip

The first thing when installing pip on your CentOS system is to add an EPEL repository. This is because pip may not be present in the core repositories for CentOS 7. Execute the command below to activate the EPEL repository:

$ sudo yum install epel-release

Once you enable the EPEL repository, you can go ahead and run the command below to install pip and all its required dependencies:

$ sudo yum install python-pip

By now, the pip package is installed on CentOS 7, but we need to verify this installation. The command below will scrutinize pip installation and print the version installed:

$ pip --version

This will give you an output similar to the one below:

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

Note: The version number of pip installation may vary.

Step 2 Installing The Development Tools

By now, pip is successfully installed on CentOS 7, but we are not done! We need to install development tools which are vital for creating Python modules. Execute the commands below to install the development tools:

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

That’s it! You have installed Python pip on CentOS 7. The next step is to learn how to use the application you just installed.

Step 3 Using pip

To use pip you must understand how its basic commands work. In this step, we’ll take you through some helpful basic pip commands that will help you install packages with ease.

Basically, pip is used to install packages from PyPI but it can also be used to install modules from local projects, Version Control, and other distribution files. Here, we’ll install the package twisted as our test package:

To install this package, execute the command:

$ pip install twisted

Then, to uninstall the package:

$ pip uninstall twisted

Next, if you want to search this package, you execute the command:

$ pip search "twisted"

If you want to view all installed packages, run the command below:

$  pip list

Lastly, to view a list of all outdated packages run the command;

$ pip list --outdated

Conclusion

Congratulations! You have successfully installed Python pip on CentOS 7 system. You can now use the application to install the Python modules that you require or uninstall those that you do not need.

Check out these top 3 Linux hosting services

Was this article helpful?