[Pythonmac-SIG] Multiple version of the same module
Christopher Barker
Chris.Barker at noaa.gov
Mon Jan 26 20:01:03 CET 2009
Pierre-Alain Dorange wrote:
> How to manage a module with several versions on MacOS X ?
Unfortunately, the Python core developers have never seen the need to do
this -- I still don't know why.
A number of packages have developed their own systems (wx.version, for
wxPython, for instance) -- you might see if pygame has one.
> I've installed the stableone from source and i go into a
> "pygame-1.8.0release-py2.5-macosx-10.3-i386.egg" directory.
setuptools supposedly can do this for you too, if things are installed
as eggs -- I think pkg_resources.require() is what you need -- take a
look at the setuptools docs.
> I just install the 1.9 (for test) and it go into "pygame" directory
Ahh -so it's not an egg? If you want setuptools to help you out, you'll
have to install the dev version as an egg, too.
> When i import "pygame" from python, the 1.8.0 is imported only and 1.9.0
> is complely ignored... How do python choose from several package ? Do
> package register them elsewhere ?
no --- python looks in sys.path, and uses the first one it finds.
So, the way folks have done this in the past, pre-setuptools is
manipulate sys,path in various ways -- a script that moves *.pth files
around, or python code that directly manipulates sys.path (that's what
wx.version does)
easy_install creates a easy-install.pth file that adds the paths to eggs
that it has installed -- it puts everything before site-packages, which
is probably why your python is finding the 1.8 egg.
I know I haven't really given you the answer, but hopefully some hints
to so you can figure out your options.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the Pythonmac-SIG
mailing list