HiveBrain v1.2.0
Get Started
← Back to all entries
patternpythonCritical

Dealing with multiple Python versions and PIP

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
multiplepythonandpipdealingversionswith

Problem

Is there a way to make pip play well with multiple versions of Python? For example, I want to use pip to explicitly install things to either my site 2.5 installation or my site 2.6 installation.

For example, with easy_install, I use easy_install-2.{5,6}.

And, yes — I know about virtualenv, and no — it's not a solution to this particular problem.

Solution

The current recommendation is to use python -m pip, where python is the version of Python you would like to use. This is the recommendation because it works across all versions of Python, and in all forms of virtualenv. For example:
# The system default Python installation:
python -m pip install fish

# A virtualenv's Python installation:
.env/bin/python -m pip install fish

# A specific version of python:
python-3.6 -m pip install fish

Previous answer, left for posterity:

Since version 0.8, Pip supports pip-{version}. You can use it the same as easy_install-{version}:
pip-2.5 install myfoopackage
pip-2.6 install otherpackage
pip-2.7 install mybarpackage


pip changed its schema to use pipVERSION instead of pip-VERSION in version 1.5. You should use the following if you have pip >= 1.5:
pip2.6 install otherpackage
pip2.7 install mybarpackage


Check Versioned commands consistent with Python. #1053 for more details

References:

  • Need pip-x.y scripts #200



  • v0.8 changelog or News for pip, v0.8

Context

Stack Overflow Q#2812520, score: 990

Revisions (0)

No revisions yet.