How to install pip on Ubuntu and Debian server

Steps to install pip on Ubuntu and Debian server with apt

1. Log into your Ubuntu/Debian server

2. Run ‘apt update’ command on your Linux server

You might get the below error if you are trying to install python pip without running apt update.

When you run the ‘apt update’ command, it will download the updated package list information from the repository.

E: Unable to locate package python3-pip
E: Unable to locate package python-pip

3. Check the python version before installing pip

Run the below command to check whether the installed version is Python 2 or 3

 

# python -V
Python 2.7.5

 

4. Install pip using apt Advanced Packaging Tool

Run the command “apt install python3-pip” if you are using Python 3 on your server.

Execute the command ‘apt install python-pip’ if python 2 is installed on your server.

5. Type ‘y’ and hit enter if apt ask for confirmation while installing the package.

pip and the required dependencies will be installed.

 
 

Steps to install Python pip using get-pip.py

Alternately you can install pip by downloading get-pip.py script.

1. Log into your Ubuntu/Debian server

2. Download get-pip.py from pypa.io website

 

Command :

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

 

3. Run get-pip.py script

 

python get-pip.py