How to Install Pip on CentOS 6 Linux

July 7, 2019

Comments

Adsense

Adsense

Adsense

Adsense

The Pip is a standard package manager for Python programming language. It is use to install and manage additional packages that are not available in the Python standard library. By default, Pip is not available in CentOS 6, but we can install it using simply like any other application.

In this tutorial guide, we will show you how to install Python Pip on your CentOS 6 system using “yum” package manage (Red Hat default package manager). We will also learn how to install and manage Python packages with Pip.

Prerequisites

We need a CentOS 6 system, and a user credential with sudo privileges to login into the system and run administrative command to install packages.

Install pip for Python 3

We can run Python 2 and Python 3 both in a system so in the same way we can keep pip for Python 2 and Python 3 also.

To install pip (pip3) for Python 3, follow below-given steps:

Step 01: First update the package list in CentOS repository using the following command:

$ yum install epel-release
$ sudo yum update

Step 02: Now we can install pip (pip3) and all required dependencies for Python 3 using below command:

$ sudo yum install python3-pip

Step 03: After completing the installation, verify the installation by checking the version of pip using the following command:

$ pip3 --version
Output-
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

Install pip for Python 2

If your system has Python 2 installed you can install pip for Python 2 by below steps:

Step 01: First update package list in your CentOS repository using the following command:

$ yum install epel-release
$ sudo yum update

Step 02: To install pip for python 2 use the following command:

$ sudo apt install python-pip

This command will install pip and required dependencies for building Python modules.

Step 03: After completing the installation, verify the installation by checking the version of pip using the following command:

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

How to use Pip

The Pip is use to install python modules. Still, it is highly recommended to install Python modules provided by distribution using the “apt” package manager, as these are tested to work correctly on CentOS machine.

You should use the pip package manager to install the package globally only if the package is not provided through the default “apt” package manager.

We generally use Pip within a virtual environment. The Python “Virtual Environment” allows us to install python packages and modules in an isolated location for a single project, and it is not usable by globally. And it would be best if you are no worried about other projects as it is not affecting other projects.

In this tutorial, we will show you the use of basic pip commands. By using Pip, we can install packages from PyPI, distribution files, local projects, and from version control, but most of the cases we use it to install from PyPI.

You can check all available pip commands and options using the following command:

$ pip3 --help
how to use pip command

You can get more information about the specific pip command using “pip <commad> –help”. For example, if you want to know about “pip install” command, you can use the following command:

$ pip3 install --help

Installing Packages with Pip

In this tutorial, we will check pip installation command by installing a package called “scrapy”; it is use to scrape and extract data from websites.

To install the latest version of “scrapy” package, use the following command:

$ pip3 install scrapy

If you want to install a specific version of “scrapy” package use the command like below we use to install “scrapy” version 1.2.

$ pip3 install scrapy==1.5

Note – replate pip with pip3 if you are using Python 3.

Installing packages using the Requirements files for Pip

The “requirement.txt” file is a file containing the list of pip packages and versions, which is use to run the specific project.

To run the project without any issue, we need to install all those packages first by using the following command:

$ pip3 install -r requirements.txt

List out the installed packages

To check the all installed pip packages in the system, use the following command:

$ pip3 list

Upgrade a package using Pip

To upgrade any specific pip package to the latest version run the following command:

$ pip3 install --upgrade package_name

Uninstalling a package using Pip

To uninstall a specific pip package run the command as shown below:

$ pip3 uninstall package_name

Conclusion

Now you have learned about Python package manager called Pip. You are ready to install and configure Pip package manage in your CentOS 6 machine. You have learned how to install, upgrade, and uninstall packages using the pip package manager.

If you have any doubt, questions, or feedback, feel free to comment below.

Satish Kumar

Satish Kumar

I am Satish Kumar, Founder of LinuxConcept. Linux and F.O.S.S enthusiast, love to work on open source platform and technologies.

Adsense

Adsense

Adsense

Adsense

Adsense

Adsense

Adsense

Adsense

Adsense

Related Posts

How to Install MongoDB on CentOS 8 Linux

How to Install MongoDB on CentOS 8 Linux

MongoDB is an open-source and free NoSQL document based database system. Nowadays, it is prevalent as most application developers are using MongoDB, which can handle big data. As a MongoDB is a NoSQL database, It stores data in JSON-like documents where fields can...

How to Install OpenCV on CentOS 8 Linux

How to Install OpenCV on CentOS 8 Linux

OpenCV (Open Source Computer Vision Library) is an open-source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in commercial...

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

seven − two =

News & Updates

Join Our Newsletter

Adsense

Adsense

Adsense

Adsense