How to install pip for Python 2

Posted on Aug 15, 2022

Question

I run

python --version

and get

Python 2.7.3

I run

pip --version

and get

pip 1.5 from /usr/local/lib/python3.2/dist-packages/pip-1.5-py3.2.egg (python 3.2)

I installed pip using apt-get. How to I get the Python 2 version of pip?

I've reinstalled python and python-pip several times with apt-get. I'm also curious why these would install different Python versions.

Answer

To install pip for Python2 on Ubuntu, this worked for me

sudo apt update
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py

It's based on DareDevil7's answer but notice the url is different.