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.
Install pip3 Ubuntu and Debian LinuxUbuntu 18.04 has both Python 2 and Python 3 installed by default, and hence has two pip variants for each Python version. 'pip', refers to Python 2. pip3 refers to Python 3. Ubuntu 20.4 has only Python 3, but still requires a separate python-pip 3 installation.
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.
I would suggest that you use pyenv
to manage multiple versions of Python, because it can often get problematic. Right now the solution to the problem would depend on the configuration you have for pip and python in your bash.
One thing you can do is download the easy_install
script, and use python 3 to run it and install pip for python 3 alone.
If there are both python2.7 and python3 in you ubuntu system,run this
sudo apt install python-pip
There will be pip
for python3 ,pip2
for python2
If you really want to install pip globally for your system use the get-pip.py script with the wanted python binary http://www.pip-installer.org/en/latest/installing.html#install-or-upgrade-pip
python2.7 get-pip.py
But you should consider using virtualenv / buildout to get an isolated environment
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With