Alternatively, since pip itself is written in python, you can just call it with the python version you want to install the package for:
Copypython2.7 -m pip install foo
Answer from Turion on Stack OverflowAlternatively, since pip itself is written in python, you can just call it with the python version you want to install the package for:
Copypython2.7 -m pip install foo
Use a version of pip installed against the Python instance you want to install new packages to.
In many distributions, there may be separate python2.6-pip and python2.7-pip packages, invoked with binary names such as pip-2.6 and pip-2.7. If pip is not packaged in your distribution for the desired target, you might look for a setuptools or easyinstall package, or use virtualenv (which will always include pip in a generated environment).
pip's website includes installation instructions, if you can't find anything within your distribution.
Update: In the modern (2020s) world, python -m pip is the right way to do this, where python can be replaced with whichever interpreter you choose.
I have multiple python instances and virtual environments. But I want pip to install packages onto a specific version. Preferably to "set it to default" or something. How can I do that?
Is it possible to install Pip for older versions of Python?
How do I choose what python version pip installs packages to.
Are python packages tied to a specific python version?
How to install with pip directly from GitHub?
Videos
You have two options, but either way, you need to get easy_install-3.2. Since it doesn't seem to be packaged, you have to install it yourself. Fortunately that's easy. And you should also get python3-pkg-resources, which is packaged:
sudo apt-get install python3-pkg-resources
wget http://python-distribute.org/distribute_setup.py
sudo python3 distribute_setup.py
Now you can just use easy_install-3.2 to install Pyramid, or go ahead and install pip in Python3.
OPTION 1:
sudo easy_install-3.2 pyramid
OPTION 2:
sudo easy_install-3.2 pip
sudo pip-3.2 install pyramid
Alternatively, if you want to install specific version of the package with the specific version of python, this is the way
sudo python2.7 -m pip install pyudev=0.16
If the "=" doesnt work, use "=="
sudo python2.7 -m pip install pyudev=0.16
Ouput: Invalid requirement: 'pyudev=0.16' = is not a valid operator. Did you mean == ?
sudo python2.7 -m pip install pyudev==0.16
works fine
You have to use virtualenv otherwise all installations would go to default installed python.
What virtualenv will do is install multiple python versions having separate installed modules on the system and you can choose to run any version anytime you want. It's the default way of python world to manage different versions.
Also install virtualenvwrapper which simplifies usage of virtualenv.
The easiest option is probably to use virtualenv with the --python parameter to specify your custom installation. Then install the modules you want using easy_install or pip.
The Right Way is to build Debs/RPMs for all the modules.
» pip install pip