[Pythonmac-SIG] MySQLdb on OS X 10.6

Ned Deily nad at acm.org
Tue Oct 26 09:21:08 CEST 2010


In article <30054281.post at talk.nabble.com>,
 brinsknaps <brian.nguyen at gmail.com> wrote:
> I know it's been a long time since you posted this message, but I've been
> pulling out my hair running into the same issue. I've tried installing
> 32-bit and 64-bit versions of mysql to test different compatibilities with
> python 2.6.6, but have had no luck. By any chance did you figure out a
> solution to this problem?

The key to successfully installing MySQLdb on 10.6 is to ensure that the 
Python version, MySQLdb, and the MySQL client libraries are all built 
with a common architecture (i386 or x86_64) and ABI (deployment target).  
Unfortunately, that's easier said than done if you try to do it yourself 
from source or with installers from various sources.  It can be done but 
my advice is to install everything from MacPorts 
(http://www.macports.org/).  If you haven't already, download and run 
the base MacPorts installer.   Then you can build and install everything 
you need with:

$ sudo /opt/local/bin/port selfupdate
$ sudo /opt/local/bin/port install py26-mysql

py26-mysql is the MacPorts port name for MySqLdb and installing it will 
automatically also build all necessary dependencies like Python 2.6 and 
the MySQL client libraries and they will be built compatibly.  To prefer 
the MacPorts python2.6, add its framework bin directory to the front of 
your shell search PATH, so something like;

$ export 
PATH=/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin:
/opt/local/bin:$PATH

You'll find more suggestions and details by searching on StackOverflow.

-- 
 Ned Deily,
 nad at acm.org



More information about the Pythonmac-SIG mailing list