pip2 installation on ubuntu 20.04

Viewed 23274

After installing succesfully python2 on ubuntu 20.04 with: sudo apt install python2

I downloaded get-pip.py from https://bootstrap.pypa.io/get-pip.py sha256: ffb67da2e976f48dd29714fc64812d1ac419eb7d48079737166dd95640d1debd

Running:

sudo python2 get-pip.py

Traceback (most recent call last):
File "get-pip.py", line 24226, in
main()
File "get-pip.py", line 199, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
from pip._internal.cli.main import main as pip_entry_point
File "/tmp/tmp6DHWFv/pip.zip/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax

3 Answers

you can use this commands. It's working right now. You have to install with Python2

wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2 get-pip.py

This version seems not working, so I downloaded a previos version from:
https://bootstrap.pypa.io/2.6/get-pip.py. After running the following command:

sudo python2 get-pip.py

pip version 9.0.3 was installed. Following a

sudo pip install --upgrade pip

pip 20.3.4 was installed. Enough to run the python tools I need.

I will post an updated answer here. Pip authors updated the link and asked for apologies.

wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2 get-pip.py
Related