How to install Python pip on Linux?


Python pip in Linux is a package management tool used to find, install, remove and list the packages from the Python Package Index (PyPI).

In this article, we will discuss how to install pip on Linux for Python 3 and Python 2 on different distributions.

If you have not installed Python yet on your Linux system then follow how to install Python 3 on Linux.

How to install Python pip on Linux Mint / Ubuntu Linux?

We need to install pip for Python 2 and 3 separately on Ubuntu/ Linux Mint. Now use the following command for –

Install pip for Python 3

Use the following command to update the local package database –

sudo apt update

And then use the following command to install pip for Python 3 –

sudo apt install python3-pip

You can verify the installation by using –

pip3 --version

Install pip for Python 2

First, use the given command to update the local package database –

sudo apt update

To install pip2 for python2 your need to enable universe repository on Ubuntu or Linux mint. Use the following command to use add universe repository on your system –

sudo add-apt-repository universe

And then use –

sudo apt install python2

How to install pip on CentOS / RHEL Linux

To install pip for python2 and 3 you can use the following commands.

Install pip for python 3

The Python pip for python 3 comes with the python3 package on CentOS or RHEL. You can install pip3 by using the following command –

sudo yum install python3

You can verify the installation by using –

pip3 --version

Installing pip for python 2

You can install Python 2 package to install Python 2 with pip for it. The python 2 package is available in the epel-release repository.

First, use the following command to install the epel-release repository on your system –

sudo yum install epel-release

And the use the given command to install the package on your system –

sudo yum install python2

You can verify the installation of pip2 by using –

pip2 --version

How to install pip on Arch Linux/ Manjaro

Use the following command to install python3 pip on Arch Linux or Manjaro –

sudo pacman -S python-pip

To install pip for python 2 use –

sudo pacman -S python2 pip

You can verify the installation by using –

pip3 --version

Conclusion

Now pip for Python 2 or 3 is installed on your system. You can use it to find, install or remove a python package on your system. If you have a query related to this then leave it in the comments below.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.