Install PIP in Ubuntu 19.10

PIP is basically a Python package installer. Python packages are available either in standard library or they could be fetched from PyPI (Python Package Index). When we install Python through its one of binary installers, we do get PIP with it. For users, who prefer to use the version of Python already available in standard Ubuntu repository need to install PIP on their own. This article focuses on installation steps required to get PIP in Ubuntu 19.10.

Note: Following operations would require you to have superuser privileges. In case you don’t have one, then contact your System Administrator for assistance.

Install PIP in Ubuntu 19.10

The installation process is pretty straight-forward. We need to first identify the version of PIP we would like to install as per our requirements. This would depend largely on the version of Python you would use. Therefore, to use PIP/PIP2 install python-pip package. Otherwise, install python3-pip package for PIP3.

But, before that we need to update the repository.

sudo apt update

To install PIP/PIP2 –

sudo apt install python-pip

To install PIP3 –

sudo apt install python3-pip

Confirm the version installed with –

pip -V

or,

pip3 -V

In Conclusion, we have discussed how to install PIP/PIP2/PIP3 in Ubuntu 19.10

Additional Info

There are three ways to install Python packages –

  1. Through Python package installer – PIP
  2. easy_install
  3. manually

Now, we will discuss a bit on how to install a Python package with the help of an example.

To install Python packages, we issue the command in terminal –

pip install package_name

Consider installing beautifulsoup4, if you want to scrape data from web pages – HTML or XML. Therefore, to install the package for beautifulsoup4 we need to issue the following in terminal –

pip install beautifulsoup4

Furthermore, if you want to uninstall a package then run the following in terminal –

pip uninstall package_name

for instance, if you want to remove the installed package beautifulsoup4. Then, issue the following in terminal –

pip uninstall beautifulsoup4

Replace PIP above with PIP3 if you have been using Python v3. We would discuss more about PIP/PIP2/PIP3 in coming articles.