I have 2 python instance on a CentOS machine, i.e. /usr/bin/python2.4 and /usr/bin/python2.7.

Modules for 2.4 are in /usr/lib/python2.4, and modules for 2.7 are in /usr/local/python27.

When I do yum install numpy, which I want to install for python2.7, it automatically install for python2.4.

How can I appoint which instance to install modules for with yum, easy_install and pip?


Your yum probably only has packages for the Python version that is used by the OS (it is possible to share, package-manager installed, native python modules between different versions but it is more difficult to configure).

The best option for you is install pip for your /usr/local/python27 by downloading get-pip.py as per the manual and then running it with the python2.7 executable:

python2.7 get-pip.py

You only have to this once, and this will give you a command pip2.7 which you can use to install any package from PyPI into the Python 2.7 setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.