Sidhak Verma
Myself Sidhak I am a student and a content writer. I share my ideas on social media and finding ways of earning money online on the internet.
Pip (short for “Pip Installs Packages”) is an important tool if you use Python. It allows you to easily install, update, and...
Image Credits: canva
Pip (short for “Pip Installs Packages”) is an important tool if you use Python. It allows you to easily install, update, and manage Python packages. Whether creating a development environment or working on a project, having Pip installed makes things much easier. This article will teach you all you need to know about how to install pip on Linux using various techniques. Whether you use Ubuntu, Debian, Fedora, Centos, or Arch Linux, we have got you covered!
Pip is a package manager for Python. It allows you to install and manage hundreds of Python libraries listed in the Python Package Index (Pypi). Without Pip, you’d have to manually download and install Python packages, which takes time and is prone to errors.
Before we begin installation, let us first check to see if Pip is already installed on your system.
Before installing Pip, let’s see if it’s already installed.
Run this command:
python3 –version
If Python is installed, you’ll see an output like:
Python 3.x.x
If Python is not installed, install it first before proceeding with Pip.
pip3 –version
If Pip is installed, it will show an output similar to:
pip 22.x.x from /usr/lib/python3/dist-packages/pip (python 3.x)
If you get a “command not found” error, Pip is not installed, and we need to install it.
Use the following command:
sudo apt update
sudo apt install python3-pip -y
For Fedora:
sudo dnf install python3-pip -y
For Centos 7:
sudo yum install python3-pip -y
For Arch-based distributions:
sudo pacman -S python-pip
If Pip is not available through your package manager, you can install it manually.
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
This method ensures you get the latest version of Pip directly from Pypi.
Once installed, verify it using:
pip3 –version
Expected output:
pip 22.x.x from /usr/lib/python3/dist-packages/pip (python 3.x)
To keep Pip updated:
pip3 install –upgrade pip
If you need to remove Pip:
python3 -m pip –version
If it works, use python3 -m pip install <package>.
Use sudo or install packages for the current user:
pip install –user <package-name>
Reinstall certificates:
sudo apt install– reinstall ca-certificates
pip install requests
pip uninstall requests
pip list
To keep your project dependencies isolated, use a virtual environment.
python3 -m venv myenv
source myenv/bin/activate
Install packages normally inside the environment.
Deactivate with:
deactivate
Save installed packages to a file:
pip freeze > requirements.txt
Install all packages from the file:
pip install -r requirements.txt
Pip is a necessary tool for Python developers on Linux. How to install pip on Linux is simple, whether using package management or manually with get-pip.py. You can efficiently manage Python packages and simplify your development workflow by sticking to recommended practices.
Suggested:
How to run a Process in the Background on Linux?
Installing Mail Server on Linux: A Step-by-Step Guide.
How to Install Linux on a Flash Drive?