Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modules between multiple versions of Python Linux

Tags:

python

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 using 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.

like image 355
TyrantWave Avatar asked Feb 25 '23 02:02

TyrantWave


1 Answers

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/

like image 111
Lennart Regebro Avatar answered Mar 13 '23 03:03

Lennart Regebro