Modules between multiple versions of Python Linux

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

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

The problem here is that I have many devices (say more than a thousand), all running versions 2.4.4, which will soon have to be supported by this machine (for building code, releases, etc.). So far, I have used EeePC (the same device as the ones that I support) to make builds and releases that worked well. (I am developing on a 2.6 machine and building on an EeePC).

How can I get these modules to work in Python2.4? I tried reinstalling (with 2.4 as my main), but it just caused errors. The blogs / answers found say they use easy_install, but this does not support the packages I need (or at least it just died when I tried).

In short: I am currently using python 2.6, but I would like it to change to 2.4 for all modules, like what I'm going to use.

+4
source share
2 answers

You cannot 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 β€œcore” one. I'm not sure what that means. You must install wxPython for Python 2.4 by running the installer with Python 2.4, for example:

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

Or similar.

You can also use easy_install, but first you need to install Distribute for Python 2.4. Did you do it?

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/

+5
source

Do not try to share them; this has some chances of success with pure Python modules, but C modules will not work. Instead, install them using the appropriate interpreter executable, for example. python2.4 setup.py install .

+3
source

Source: https://habr.com/ru/post/1339627/


All Articles