Installing PIP on Linux to Manage Python Packages

Python is probably one of the most used programming languages in the tech-driven world of today. The language is popular among developers all around the world because it is flexible, effective, and provides a wide range of third-party modules. PIP is a key element that facilitates Python package management. This post serves as a thorough tutorial for setting up PIP on Linux to manage Python packages. It is filled with useful examples to help you understand.

Introduction to PIP

The package management system PIP, which stands for "Pip Installs Packages," is used to install and manage Python software packages. PIP connects to the PyPI (Python Package Index) online repository, where you can use a single command to access and install millions of Python packages. Every Python coder needs it as a tool.

Installing PIP on Linux

Make sure your Python environment is current before moving forward with the PIP installation. PIP is included by default with Python 2.7.9 and Python 3.4. To check the Python version on your computer, run the commands below −

python --version   # For Python 2.x
python3 --version  # For Python 3.x

The procedures listed below will help you install PIP if your Python version is outdated or PIP is not already installed −

Example 1: Installing PIP for Python 2.x

Use the following terminal command on distributions built on the Ubuntu operating system −

sudo apt-get install python-pip

Other Linux distributions, such as Centos, can be used with −

sudo yum install python-pip

Example 2: Installing PIP for Python 3.x

The package for Python 3 is called python3-pip. As a result, you can use the command −

sudo apt-get install python3-pip

Alternative Linux distributions include −

sudo yum install python3-pip

Use the following command to check the installed version and confirm that the installation was successful after it has been completed 

pip --version     # For Python 2.x
pip3 --version    # For Python 3.x

Using PIP to Manage Python Packages

PIP can be used to install Python packages from PyPI once it has been installed. Examples of installing, upgrading, and removing Python packages using PIP are given below.

Example 3: Installing a Python Package using PIP

Use the following command to install a Python package, such as "requests," which is used to send HTTP requests 

pip install requests    # For Python 2.x
pip3 install requests   # For Python 3.x

Example 4: Upgrading a Python Package using PIP

Use the following command to upgrade a package that is already installed 

pip install --upgrade requests   # For Python 2.x
pip3 install --upgrade requests  # For Python 3.x

Example 5: Removing a Python Package using PIP

Use the following command to delete an installed package 

pip uninstall requests   # For Python 2.x
pip3 uninstall requests  # For Python 3.x


PIP offers a simple approach to manage Python packages, making it a crucial tool for Python developers. This article provided usage examples for managing Python packages along with a step-by-step tutorial for installing PIP on Linux systems. Learning PIP will enable you to take advantage of PyPI's vast library of Python packages, increasing your productivity and effectiveness as a Python developer.

The ability to manage Python projects with a variety of dependencies will be greatly enhanced by your understanding of PIP as a package manager, regardless of whether you are developing web applications, data science models, or automation scripts. So, make the most of this tool to keep your Python environment well-organized, current, and productive.

We hope that this thorough manual has given you the knowledge and assurance to utilise PIP for managing your Python packages. Install that package you've been wanting to investigate, update the ones you already have to the most recent versions, or clear your environment of clutter by removing the extraneous programmes; the choice is yours.

Updated on: 17-Jul-2023


Kickstart Your Career

Get certified by completing the course

Get Started