Python

Check Pip Version

Package Installer for Python, or PIP for short, is the defacto package installer for Python.Pip allows you to perform package management operations for Python including downloading, installing, updating, and uninstalling python packages.

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 update

$ sudo apt-get install python3-pip

Once completed, verify pip is working by running the command:

$ pip3 --version

pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)

REHL

On REHL systems, run:

$ sudo yum update

$ sudo yum install python3-pip

Verify that pip is installed by running the command:

$ pip3 --version

Manjaro/Arch

On Arch-based distributions, run the command:

$ sudo pacman -Sy

$ 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:

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

Once downloaded, run the file with Python:

$ python .\get-pip.py

Once completed, run the command below to check the installed pip version.

$ 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:

setx /M path "%path%;C:\path\to\pip"

Upgrading and Downgrading Pip

You can update pip by invoking pip as a python module as shown in the command below:

python -m pip install --upgrade pip

The command above should update your pip version to the latest release.

To downgrade to a specific version of pip, use the command:

python -m pip install pip==target_version

For example, to install pip version 21.0, run:

python -m pip install pip==21.0

Pip Install Package

Once you have pip installed, you can use it to install specific packages. The syntax is as shown:

pip install <package_name>

For example, to install pandas with pip:

pip install pandas

Pandas Uninstall Package

To uninstall a package with pandas:

pip uinstall <package_name>

Pip Show Installed Packages

To show the installed packages in your environment, run the pip list command:

pip list

Pip Get Package Information

To get information about an installed package with pip, use the command:

pip show <package_name>

For example:

pip show autopep8

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.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list