How to Install PIP in CentOS, Ubuntu, and Windows?

By | June 13, 2022
How to Install PIP in CentOS Ubuntu and Windows?

If you are looking to install PIP on CentOS, Ubuntu, or Windows, you first need to understand what PIP is and what it does. Well, PIP is a standard package manager for Python.

If you want to install additional libraries that are unavailable in the Python standard library, PIP is the best option you have. So, let’s learn ‘How to install PIP in CentOS, Ubuntu, and Windows?’

This article covers the steps to help you install PIP, upgrade it, downgrade it, and use it. So, sit tight and read on.

What is PIP?

Before understanding the use of PIP, you must learn about Python. It is an interpreted, general-purpose programming language that is known for its high code readability. It is very productive, and hence programmers love it.

Python comes equipped with a standard library that has a myriad of tools to write programs. But what if you need additional libraries? You can have them for sure. That’s where PIP comes in.

Python’s package manager installs and manages additional libraries that do not form part of the standard Python library. The strength of Python is that it runs on several platforms, like Linux, Windows, macOS, and FreeBSD. It comes equipped with most Linux distributions.

How to Install PIP on CentOS?

You must know that there are 2 active versions of Python right now: Python 2 and Python 3. Here, you will get to know about the steps for installing Pip on both of these versions.

For CentOS 7

Step 1 – CentOS does not contain Pip in its core repository; thus, you need to enable the EPEL repository first. To enable it, run the following command after opening the terminal:

$ sudo yum install epel-release

Step 2 – It is best to update your package on priority with the use of the following command:

yum –y update

Now, install Python Pip.

yum –y install python-pip

Step 3 – It’s time to verify if the installation was successful. For checking the version, execute:

$ pip –version

You can also check the list of the commands, which can be very helpful in the future:

pip –help

To build Python modules, you need to install development tools with this command:

$ sudo yum install python-devel
$ sudo yum group install ‘development tools’

As an alternative to yum, you can also use Curl or Python to install Pip. If you are using curl, the command is: curl “https://bootstrap.pypa.io/get-pip.py -o “get-pip.py.” For Python, use the command: get-pip.py

For CentOS 8

CentOS 8 does not necessitate users to any specific version of Python. Thus, here, you will learn about installing Pip on both Python 2 and Python 3 with dnf or yum repositories.

Installing Pip on Python 2

Step 1 – The command to install Python2 Pip is:

$ sudo dnf install python2

The installation is complete.

Step 2 – Now verify the installation with:

$ pip2 –version

Step 3 – Install development tools using the following commands:

$ sudo yum install python2-devel

$ sudo yum group install ‘development tools’

Installing Pip on Python 3

Step 1 – To install Python 3 pip, take the help of the following command:

$ sudo dnf install python3

Step 2 – Then verify your installation using the following command:

$ pip3 –version

Step 3 – Install development tools using:

$ sudo yum install python3-devel

$ sudo yum group install ‘development tools’

How to Install PIP on Ubuntu?

Once again, the steps will guide you to install Pip for both the versions of Python; Python2 and Python3. The apt command-line tool is recommended here to install PIP.

Installing Pip on Python 2

Step 1 – The Ubuntu core repository does not include Pip, so you need to enable the universe repository first. Do so using the following command:

 $ sudo add-apt-repository universe

Step 2 – Update the package using this command:

$ sudo apt update

Step 3 – Install Python2 using the following command:

$ sudo apt install python2

Step 4 – Install Pip.

$ sudo python2 get-pip.py

Pip can also be installed using curl with the following command:

$ curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py

Step 5 – Verify the installation using the following command:

$ pip2 –version

Step 6 – You can view the list of all the helpful commands by executing the following command:

$ pip2 –help

Installing Pip on Python 3

Step 1 – Install Pip for Python 3 using the following commands:

$ sudo apt update

$ sudo apt install python3- Pip

Step 2 – Verify the installation with the following command:

$ pip3 –version

How to Upgrade Pip on CentOS/Ubuntu?

It is very easy to upgrade your Pip version using this command:

$ python –m pip install –U pip

How to Downgrade Pip on CentOS/ Ubuntu

If you wish to downgrade your Pip to a specific version due to any reason, use this command:

$ python – m pip install pip==18.1

How to Install Pip on Windows?

You can use PyPI to install Pip, as it is the online repository of python packages. It will find the package for you and download it on your system. All you have to do is execute the following command:

pip install package_name

You can also download it by using the command line.

  • Step 1 – As the first step, download the get-pip.py file on your Windows PC. Paste it in the same directory as Python.
  • Step 2 – Now, copy the path of the above directory and paste it into the command line.
  • Step 3 – Install Pip using the following command:
python get-pip.py

Step 4 – Verify the installation using this command:

pip –V

How to upgrade Pip on Windows?

To upgrade pip on Windows, use:

C:\ >py –m pip install –U pip

How to downgrade Pip?

You can downgrade your pip version to any specific one by executing this command:

C:\ >py –m pip install pip==18.1

Conclusion

Installing Pip is very easy. The commands are simple, and even a beginner can execute them without any difficulty. It will add new libraries, and you can enjoy several functions for writing applications.

This comprehensive guide will help you to get Pip on your system, whether it is CentOS, Ubuntu, or Windows.

Leave a Reply

Your email address will not be published.