2010-06-22 52 views
2

我想在我的mac中安装python mysqldb,但出现以下错误。对于mysql,我使用的是与MAMP捆绑在一起的那个。谢谢!安装python MySQLdb时出现MacOS X错误

这里是错误消息:

running build 
running build_py 
copying MySQLdb/release.py -> build/lib.darwin-8.11.1-i386-2.3/MySQLdb 
running build_ext 
building '_mysql' extension 
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/Applications/MAMP/Library/include/mysql -I/System/Library/Frameworks/Python.framework/Versions/2.3/include/python2.3 -c _mysql.c -o build/temp.darwin-8.11.1-i386-2.3/_mysql.o 
_mysql.c:36:23: error: my_config.h: No such file or directory 
_mysql.c:38:19: error: mysql.h: No such file or directory 
_mysql.c:39:26: error: mysqld_error.h: No such file or directory 
_mysql.c:40:20: error: errmsg.h: No such file or directory 
_mysql.c:76: error: parse error before 'MYSQL' 
_mysql.c:76: warning: no semicolon at end of struct or union 
_mysql.c:79: error: parse error before '}' token 
_mysql.c:79: warning: type defaults to 'int' in declaration of '_mysql_ConnectionObject' 
_mysql.c:79: warning: data definition has no type or storage class 

....

回答

3

我想这是不够的,使用与MAMP捆绑在一起的MySQL,因为它不包含MySQL的C开发工具(即头文件,如mysql.h)。 Here是在Mac OS X上编译Python的MySQL扩展的分步教程,但看起来您需要“官方”MySQL发行版。