I’ve been happily using Django and MySQL in development on an existing machine running OS X 10.4 Tiger, and have set up a similar environment in 10.5 Leopard on a new 64-bit MacBook, with a working MySQL and Python 2.6.4.
However, now I want them to communicate, easy_install MySQL-python gave ld warnings that the file is not of the required architecture, which led me to test my Python 2.4.6 install (from the Mac OS X disc image):
>>> import sys
>>> sys.maxint
2147483647
Ah. So my Python install appears to be 32-bit and (I think?) won’t install MySQL-python for my 64-bit MySQL. There are lots of hacks out there for MySQL-python on OS X (mostly 1.2.2), but – after hours of reading – I’m pretty sure they won’t fix this architecture mismatch. So I’m stuck because I can’t decide whether to:
- give up, remove the 64-bit MySQL install (thorough methods, please?) and use the 32-bit MySQL disc image instead;
- re-install Python in 64-bit mode from the tarball,
--with-universal archs-64-bitand--enable-universalsdk=
as detailed in Python.org’s 2.6 news.
So my questions for anyone who has encountered this issue are:
- Is installing 64-bit Python on OS X 10.5 worth bothering with?
- If so, (naive, lazy question!) how are the two required arguments combined?
- If I just skip along in 32-bit (as on my working setup) what am I missing?
I’m after a hassle-free install that’s easy to reproduce on other machines (possible student use) so I’d really welcome your opinions, please!
I’m posting this here in case anyone finds this page and needs an answer…
Solution: remove the MySQL 64-bit install (change the below to match your MySQL version number):
Install the latest 32-bit MySQL package from the downloads page and set it up as required.
Remove MySQL-python with:
Then delete the egg in
site-packagesand make sureeasy_install -mremoved the package line in theeasy-install.pthfile there.Start up MySQL, then re-install MySQL-python (make sure you get the latest version – 1.2.3 – at time of writing):
easy_install MySQL-pythonTest it:
For me, that solved the problem. No need to edit _mysql.c (as advised for MySQL-python 1.2.2) or mess with any other settings.
Should you need them (if the above fails, or if you really want to try a 64-bit install), here are some of the links used while researching this:
But note this:
And for anyone on Snow Leopard:
Finally, the MacPython 2.7 installer now covers 64 bit. See this post for the differences between running 64 and/or 32 bit.