问题
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:
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
.
回答2:
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.
来源:https://stackoverflow.com/questions/5991193/installing-modules-for-multiple-python-versions