How to install pip for Python 2

I ran

python --version 

and get

 Python 2.7.3 

I ran

 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 get Python 2 pip version?

I reinstalled python and python-pip several times using apt-get . I am also wondering why they install different versions of Python.

+6
source share
3 answers

If you really want to install pip globally for your system, use get-pip.py script with the required 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

+1
source

I would advise you to use pyenv to manage multiple versions of Python, because a problem can often occur. Currently, the solution to the problem will depend on the configuration you use for pip and python in 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.

0
source

Download tar.gz of pip from https://pypi.python.org/pypi/pip#downloads .

Unzip or Untar, then from its untar install the directory for any specific version of python using

 python2.7 setup.py install 

or

 python3.3 setup.py install 
0
source

All Articles