4

I have installed python 2.6.6 and python 2.5.5 on the same machines (Ubuntu 10.0.4), since 2.6 is my default version and 2.5 I need for maintaining old stuff. But I have a problem to install modules(MySQLdb and net-snmp) to non-default 2.5v. It seems that only 2.6 is updated when 'sudo apt-get install _module_name_' is called. Is there a way to tell for which version module should be installed? Thanks in advance

1
  • 1
    You should be using virtualenv instead of global installed. Anyway, you can override the installation directory through --install-dir and specify the site-packages of your desired python version. Commented May 13, 2011 at 11:40

2 Answers 2

3

You can use easy_install. To use it for particular version, you just execute it like for example sudo python2.5 easy_install package_name.

Sign up to request clarification or add additional context in comments.

3 Comments

pip is recommended over easy_install because of how pip plays with virtual env
@Jakob: the situation described is not vituralenv and pip still ins't drop in replacement for easy_install. For example it cannot install from .egg.
Thank you.This way I succeeded to install various modules, but I have got stuck with net-snmp-python.This package isn't listed in pypi.python.org, but it is available in repositories (apt-get install net-snmp-python) and also source codes and rpm files can be found (net-snmp.org/wiki/index.php/Python_Bindings). However using easy_install with source codes failed, since setup.py is not available. According to this: net-snmp.org/wiki/index.php/Python_Bindings package is also located in some python subdirectory, but I can't find it anywhere within Python2.5.5 source codes.
1

You could install Pip for both 2.5 and 2.6 then create an alias in your bashrc like I have which I can do

pip25 install _package_ 

or

pip26 install _package_ 

That way you have exact control over where a module installs.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.