Python Ubuntu

How to Install Python PIP Tool on Ubuntu 20.04

PIP is a software tool that helps you install various Python packages on your system. With the help of the PIP tool, you can install packages collected from the PyPI Python Package index repository and other index repositories onto your system. In this article, I will show you how to download and install the PIP tool for Python 2 and Python 3 on your Ubuntu 20.04 system in 8 easy steps.

Installing the PIP and PIP3 Tool

In the Ubuntu 20.04 operating system, Python packages are added in base system installation. Always use PIP in an isolated container, instead of using it globally, so that installing a new package only works for the existing project and does not affect other areas of the system.

Step 1: Update Your APT

As always, first, update and upgrade your APT.

$ sudo apt update

$ sudo apt upgrade

Step 2: Add Universe Repository

Add the universe repository in your apt and the get-pip.py script to install the Python 2 PIP tool.

$ sudo add-apt-repository universe

$ sudo apt install python2

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

$ sudo python2 get-pip.py

Step 3: Install PIP for Python 3

Install PIP for Python 3 using the following terminal command.

$ sudo apt install python3-pip

Step 4: Verify Installation

Once the installation is completed, you can verify the installation by executing the following two terminal commands.

$ pip --version

$ pip3 --version

Step 5: Replace Keyword

Now, you should be able to search the Python packages using the following terminal command. Replace scrapy with your desired keyword.

$ pip3 search scrapy

Step 6: Install Python Package

Install the searched Python package using the following terminal command.

$ pip3 install scrapy

Step 7: Uninstall Excess Tools

You may remove or uninstall any unnecessary tools that have been installed by executing the following terminal command.

$ pip3 uninstall scrapy

Step 8: Additional Commands

For additional commands, execute the following terminal command. Replace pip3 with pip.

$ pip3 --help

Uninstalling PIP

You can remove the PIP and PIP3 tools from Ubuntu via the following terminal commands.

$ sudo apt-get purge pip

$ sudo apt-get purge pip3

$ sudo apt-get autoremove

Conclusion

This article showed you how to install PIP and PIP3 packages on Ubuntu 20.04, some tips for basic usage of the PIP and PIP3 utilities, and how to uninstall these tools from Ubuntu 20.04.

About the author

Avatar

Younis Said

I am a freelancing software project developer, a software engineering graduate and a content writer. I love working with Linux and open-source software.