How to Install Pip on CentOS 7

Introduction

Pip Installs Packages (Pip) is a package management system that simplifies installing and managing software packages written in Python.

Since it is a command-line program, when installed, Pip’s command line is added to the system. All packages listed in the Python Package Index (PyPI) can be installed using Pip. It comes as standard on Python 2.7.9 or higher (on Python series 2) and Python 3.4 or higher (on Python series 3).

In this tutorial, learn how to install Pip on Centos 7.

Tutorial on how to install Pip on CentOS 7

2 Options For Installing Pip on CentOS

Installing Pip on CentOS 7 is a very simple process.

There are two methods:

  1. Install with Curl and Python
  2. Installing with Yum

Both methods are explained in the sections below.

Note: If you are running a newer CentOS version, refer to How to Install Pip on CentOS 8.

Install Pip on CentOS 7 with Curl and Python

1. Download the package from the official repository using the curl command:

curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"

2. Then, install Pip with:

sudo python get-pip.py

3. Next, verify the installation:

pip -V

Your Pip version may vary, but the output format should be as seen in the image below:

Verify you have successfully installed Pip on CentOS

Install Pip on CentOS 7 with Yum

By default, Pip is part of the Extra Packages for Enterprise Linux (EPEL) repository. If you still haven’t enabled the EPEL repository, do so prior to installing Pip.

1. Open the terminal (if you are working locally) or connect to the CentOS 7 server via SSH.

2. To enable the EPEL repository, run the command:

sudo yum install epel-release

3. Confirm the installation by typing y process and wait for the system to complete the task.

4. Before you can download Pip you need to update your packages:

sudo yum –y update

5. Now install Pip with the command:

sudo yum install python-pip

6. Verify the installation with:

pip –V

Note: To see a list of all the pip commands type: pip --help. For examples of how to use them, take a look at some of the essential Pip commands explained.

How to Uninstall Pip on CentOS

Depending on how you installed Pip, there are two ways to remove the software from your system.

If you used curl (the first option), you can delete Pip by running:

sudo pip uninstall pip

Confirm you want to proceed by typing y. The output will display you have successfully uninstalled Pip.

Output showing you have successfully uninstalled Pip from CentOS.

On the other hand, if you installed Pip from the EPEL repository, remove it with:

sudo yum remove python-pip

Press y to verify. You should see a message as in the example below.

screenshot of Remove Pip from CentOS

Conclusion

Great job! You have finished the installation of Pip on CentOS 7.

Pip’s emphasis on code readability and ease of use make it the go-to solution for installing and managing Python software packages.

原创文章,作者:bd101bd101,如若转载,请注明出处:https://blog.ytso.com/tech/dev/222754.html

(0)
上一篇 2022年1月6日 17:44
下一篇 2022年1月6日 17:45

相关推荐

发表回复

登录后才能评论