安装python MySQLdb时MacOS X错误 [英] MacOS X Error when installing python MySQLdb

查看:98
本文介绍了安装python MySQLdb时MacOS X错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在Mac中安装python mysqldb,但出现以下错误.对于mysql,我使用的是与MAMP捆绑在一起的产品.谢谢!

I am trying to install python mysqldb in my mac but I got the following errors. For mysql I am using the one that is bundled with MAMP. Thanks!

这是错误消息:

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

....

推荐答案

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

I guess it's not enough to use the MySQL that's bundled with MAMP, as it does not contain the C development tools for MySQL (i.e. the header files such as mysql.h). Here is a step-by-step tutorial on compiling the MySQL extension for Python on Mac OS X, but it looks like you will need the "official" MySQL distribution for that.

这篇关于安装python MySQLdb时MacOS X错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆