Dealing with multiple Python versions and PIP?


Is there any 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.

3/11/2019 9:54:35 AM

Accepted Answer

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:
$ python -m pip install fish

# A virtualenv's python:
$ .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

EDIT: 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 for more details


12/3/2018 6:24:57 PM

In Windows, you can execute the pip module by mentioning the python version ( You need to ensure that the launcher is on your path )

py -3.4 -m pip install pyfora

py -2.7 -m pip install pyfora

Alternatively, you can call the desired python executable directly like this:

/path/to/python.exe -m pip install pyfora

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow