QuickTopic free message boards logo
Skip to Messages

TOPIC:

macpythonmodules

5
Deleted by topic administrator 07-22-2006 10:21 AM
4
MrHappyPerson was signed in when posted
07-28-2003
11:24 AM ET (US)
Thanks for the posts guys. I managed to get it to compile against the correct vers of Python that I wanted but it now appears that MySQLdb isn't compatible with Python 2.3b2.
3
Rob Tillotson
07-28-2003
06:20 AM ET (US)
When you run the setup.py to build and install the module, it will be built and installed for whatever version of Python you used to run setup.py.

You should not (and possibly cannot) share binary modules between different versions/builds of Python. The Apple-provided one is a non-framework build of 2.2, and the current MacPython is a framework build of 2.3, so it isn't likely that binary modules will work on both. (On other Unices you can usually import a binary module built for an older version of Python into a newer version, but a warning message will be printed; on OSX there is additionally the issue of framework vs. non-framework, and I'm not sure how that affects binary compatibility. Safest to just build every module twice, if you use both versions.)

Thus, if you want to use the same module with both, run "/usr/bin/python setup.py install", remove the build directory, and run "/usr/local/bin/python setup.py install". You'll end up with a separate copy of the module in each Python's site-packages directory.

It's usually a good idea to do the same for non-binary modules too, at least for ones that are installed by distutils -- you could put them in a shared location, but then the .pycs might be rebuilt every time you import one from a different version of Python from the last time. You should not add the site-packages for one version of Python to the PYTHONPATH while using another version, lest it try to import binary modules in there.
2
Benko
07-28-2003
02:35 AM ET (US)
for pure python libraries it usually helps if you setup PYTHON_PATH variable to the directory containing the module.

But if it's a library that uses "c" module, it's compiled against specific version of python and it doesn't have to work, anyway, it's worth to test it.

example:
setenv PYTHON_PATH=/usr/lib/python2.2/site-packages
1
Richard Chamberlain
07-28-2003
02:02 AM ET (US)
There is a default modules directory path where things get stored. The MySql module will probably go into site-packages which is in this path.

Try (in interactive python):
import sys
sys.path

You'll see what directories modules can be placed into.

Take a look at the docs for this:

http://www.python.org/doc/current/lib/module-sys.html

It's basically initialised in from the PYTHONPATH environment variable and some installation defaults.

Cheers,

Richard

Print | RSS Views: 3094 (Unique: 1450 ) / Subscribers: 0 | What's this?