(How to Install PIP in Linux) Python Package Installer function (PIP) enables users to control and deploy Python packages. The application enables fast installation of both libraries alongside dependencies needed for Python development. Linux distributions normally do not include PIP software as part of their fundamental package. You must carry out a manual setup to obtain PIP.
This article provides detailed instructions about PIP installation on different Linux distributions followed by verification procedures and proper PIP usage methods.
What is PIP?
The standard Python package management tool PIP functions as the default installer of packages known as “Packages through PIP Installs.” The PIP utility enables Python developers to manage package installation, update, and removal from the Python Package Index (PyPI).
You can easily install the thousands of available Python libraries that include NumPy, Pandas, Flask, Django, and numerous others through PIP.
Checking if PIP is Already Installed
Execution of the below terminal command helps to verify the presence of PIP on your system before installation.
Or, if you are using Python 3:
If PIP is installed, you will see an output like this:
If you see an error like “Command not found”, it means PIP is not installed, and you need to install it.
Installing PIP on Linux
The installation process varies depending on the Linux distribution you are using. Below, we cover installation steps for Ubuntu, Debian, CentOS, Fedora, Arch Linux, and openSUSE.
Install PIP on Ubuntu/Debian
For Ubuntu and Debian-based distributions, use the following command to install PIP for Python 3:
Once installed, verify the installation:
Install PIP on CentOS/RHEL
For CentOS, Red Hat Enterprise Linux (RHEL), and Fedora, install PIP using the dnf
or yum
package manager:
Or, if you are using an older CentOS version:
After installation, verify:
Install PIP on Arch Linux
For Arch Linux and Manjaro, use the pacman package manager:
Verify PIP installation:
Install PIP on openSUSE
On openSUSE, install PIP using zypper:
Check if the installation was successful:
Installing PIP Manually
If PIP is not available in your distribution’s package manager, you can install it manually using the get-pip.py script.
Steps to Install PIP Manually
Download the get-pip.py script using wget or curl:
Or, using curl:
Run the script with Python 3:
Verify the installation:
Upgrading PIP
After installation, it’s a good practice to upgrade PIP to the latest version to ensure compatibility with new Python packages.
Run the following command to upgrade PIP:
For Python 3, use:
Basic Usage of PIP
Once PIP is installed, you can start using it to install and manage Python packages.
Install a Python Package
To install a package (e.g., NumPy), run:
Install a Specific Version of a Package
If you need a specific version, specify it like this:
List Installed Packages
To view all installed Python packages, use:
Uninstall a Package
To remove a package, run:
Check for Outdated Packages
To see outdated packages, use:
Upgrade a Package
To upgrade a package to the latest version, run:
For example:
Conclusion
The process to install PIP on Linux distributions remains simple with installation procedures based on your system. In this guide, we covered:
- A command allows you to verify that PIP exists on your machine.
- Proceedings for PIP installation apply to Ubuntu, Debian and Fedora, CentOS alongside Arch Linux and openSUSE
- The manual installation procedure for PIP involves get-pip.py.
- The guiding procedure for PIP upgrade alongside instructions for its package installation methods and package management process
- The installation and package management of Python packages in Linux through PIP becomes simple with these provided steps.
- The Python community considers PIP as an essential requirement for both developers and beginners who handle Python projects.