Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I install pip for Python2.7 in Ubuntu 20.04

Is there any way that I can install "pip" for "Python2.7" ? I could install python2.7 by

sudo apt install python2-minimal

I tried installing pip for this.

sudo apt install python-pip / python2-pip / python2.7-pip

but none worked. Can anybody have solution for this.

like image 745
Bhimasen Avatar asked Oct 10 '20 17:10

Bhimasen


People also ask

Does pip work with Python 2?

pip installationTo use pip, first install a custom version of Python 2. pip is then installed with it. You can then use the pip command to create a virtualenv and install modules.

How do I install a specific version of pip?

To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .


2 Answers

Try this one:

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py # Fetch get-pip.py for python 2.7 
python2 get-pip.py
pip --version
like image 125
Jos Raimundo Cavalcante de Mou Avatar answered Nov 06 '22 23:11

Jos Raimundo Cavalcante de Mou


Pip for Python 2 is not included in the Ubuntu 20.04 repositories.

Try this guide which suggests to fetch a Python 2.7 compatible get_pip.py and use that to bootstrap pip.

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
like image 42
pol92 Avatar answered Nov 06 '22 23:11

pol92