gpt4 book ai didi

python - 安装 python MySQLdb 时出现 MacOS X 错误

转载 作者:行者123 更新时间:2023-11-29 02:07:39 24 4
gpt4 key购买 nike

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

这是错误信息:

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 等头文件)。 Here是关于在 Mac OS X 上为 Python 编译 MySQL 扩展的分步教程,但看起来您需要“官方”MySQL 发行版。

关于python - 安装 python MySQLdb 时出现 MacOS X 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3090709/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com