Pip offers a command-line interface for managing PyPi packages. In addition, it comes with an index of software packages for Python.
In recent versions of the Python interpreter, pip is packaged by default, and you may not need to install it.
However, you may need to install pip manually in older versions, especially if you face the “pip command not found” error.
Install Pip on Linux – Package Manager
Follow along with the steps provided below to install pip on Linux:
Debian Based Distro
On Debian based distribution, run:
$ sudo apt-get install python3-pip
Once completed, verify pip is working by running the command:
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
REHL
On REHL systems, run:
$ sudo yum install python3-pip
Verify that pip is installed by running the command:
Manjaro/Arch
On Arch-based distributions, run the command:
$ sudo pacman -S python-pip
Install Pip on Windows
Open your terminal window and download the get-pip.py installer file to install pip on windows.
https://bootstrap.pypa.io/get-pip.py
Download the file with curl as:
Once downloaded, run the file with Python:
Once completed, run the command below to check the installed pip version.
The next step is to add pip to the path environment variable. This allows you to access the pip command from any directory in your system.
Run the command prompt as administrator and execute the command:
Upgrading and Downgrading Pip
You can update pip by invoking pip as a python module as shown in the command below:
The command above should update your pip version to the latest release.
To downgrade to a specific version of pip, use the command:
For example, to install pip version 21.0, run:
Pip Install Package
Once you have pip installed, you can use it to install specific packages. The syntax is as shown:
For example, to install pandas with pip:
Pandas Uninstall Package
To uninstall a package with pandas:
Pip Show Installed Packages
To show the installed packages in your environment, run the pip list command:
Pip Get Package Information
To get information about an installed package with pip, use the command:
For example:
You should get detailed information about the package, including the installed version, location, requirements, etc.
Conclusion
This tutorial helped you learn how to install pip on Windows and Linux, update and downgrade pip, install and uninstall packages, and get package information using pip.