开发者

Modules between multiple versions of Python Linux

开发者 https://www.devze.com 2023-02-10 14:15 出处:网络
I have Python2.6.5 and Python2.4.4 on my linux machine. At the moment, all the modules I have (wx, ply, pyserial, twisted, to name a few) are installed for the 2.6 version of python. If I try to impo

I have Python2.6.5 and Python2.4.4 on my linux machine.

At the moment, all the modules I have (wx, ply, pyserial, twisted, to name a few) are installed for the 2.6 version of python. If I try to import wx on Python2.4, I get the expected no module error.

The problem here, is that I have a lot of devices (Let's say over a thousand) all running 2.4.4, which will soon need to be supported by this machine (For builds of code, releases etc). Until now, I've been usi开发者_开发问答ng an EeePC (Same device as the ones I'm supporting) to do builds and releases, which has worked well. (I develop on the 2.6 machine, and build on the EeePC).

How would I go about getting these modules to work for Python2.4? I've tried reinstalling (With 2.4 as my primary), but that just caused errors. The blogs/answers I've found say to use easy_install, but that doesn't support the packages I need (Or at least, it just died when I tried).

In short: I'm currently using python 2,6, but I'd like it to change to 2.4 for all the modules as that's what I'm going to be using.


You can't share modules between different versions of Python. If you want to use wxPython from Python 2.4, you need to install it for Python 2.4.

You said you tried to install it with Python 2.4 as your "primary". I'm not sure what that means. You would install wxPython for Python 2.4 by running the installer with Python 2.4, like so:

$sudo /usr/bin/python2.4 setup.py install

Or similar.

You can use easy_install as well, but then you need to install Distribute for Python 2.4 first. Did you do that?

I recently wrote a full explanation on my blog about this: http://regebro.wordpress.com/2011/02/02/newbie-hint-on-installing-python-and-its-modules-and-packages/


Don't attempt to share them; this has some chance of success with pure Python modules, but C modules will fail to work. Instead, install them using the appropriate interpreter executable, e.g. python2.4 setup.py install.

0

精彩评论

暂无评论...
验证码 换一张
取 消