Saturday, July 12, 2014

PIP installation - dealing with multiple python versions

Recently, I was facing this problem  of having multiple versions of python installed and pip installs the install library to the wrong python version

The solution to this is very simple:

Suppose you have different python versions, say:
1) Python 2.6
2) Python 2.7
3) Python 3.1

Pip supports the format pip-{version}

So to install a package for say python2.7 one can simply call

pip-2.7 install packagename

Similary for 3.1

pip-3.1 install packagename


Also for one having pip version 1.5 or higher the format would be pip{version}
that is the above commands will become

pip2.7 install packagename
pip3.1 install packagename

^notice that the '-' is missing in the above commands.

No comments:

Post a Comment