Installing modules for multiple python versions

落花浮王杯 提交于 2019-12-23 13:09:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!