[Pythonmac-SIG] MySQLdb on OS X?

Joe Strout joe at strout.net
Thu Oct 30 20:35:54 CET 2008


I'm trying to get a project that uses MySQL going on OS X.  Apparently  
Apple's default installation of Python doesn't include MySQLdb, so I  
downloaded it from <http://sourceforge.net/project/showfiles.php?group_id=22307 
 >, checked that mysql_config is in my path, and then did a "python  
setup.py build".

This did a number of copies, and then failed while trying to build the  
'_mysql' extension:

building '_mysql' extension
creating build/temp.macosx-10.5-i386-2.5
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused- 
madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes - 
DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -pipe - 
Dversion_info=(1,2,2,'final',0) -D__version__=1.2.2 -I/usr/local/mysql/ 
include -I/System/Library/Frameworks/Python.framework/Versions/2.5/ 
include/python2.5 -c _mysql.c -o build/temp.macosx-10.5-i386-2.5/ 
_mysql.o -Os -arch i386 -fno-common
In file included from /usr/local/mysql/include/mysql.h:47,
                  from _mysql.c:40:
/usr/include/sys/types.h:92: error: duplicate ‘unsigned’
/usr/include/sys/types.h:92: error: two or more data types in  
declaration specifiers
error: command 'gcc' failed with exit status 1

So, my questions are:

1. Is this the best way to be accessing MySQL databases from Python on  
the Mac, or is there an easier approach I've overlooked?

2. If this is it, then does anyone have a clue how to fix the error  
above?

3. Or, does anyone already have a prebuilt MySQLdb package for OS X?

Thanks,
- Joe




More information about the Pythonmac-SIG mailing list