0

我正在尝试在 python 中导入 MySQldb 并从 XAMPP 中的 php 脚本调用 python 脚本。这是我所做的:

环境: 1. Mac OSX 10.6.8 2. Python 2.6版(默认)[64bit]

到目前为止已完成: 1. 安装 XAMPP 2. MySQL 配置路径:/Applications/XAMPP/xamppfiles/bin/mysql_config 3. 下载 MySQL-python-1.2.4b4 4. 使用 MySQL 5. 的配置路径编辑 site.cfg命令

sudo python setup.py clean python setup.py build

得到以下错误:

running build
running build_py
copying MySQLdb/release.py -> build/lib.macosx-10.6-universal-2.6/MySQLdb
running build_ext
building '_mysql' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall - Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'beta',4) - D__version__=1.2.4b4 -I/Applications/XAMPP/xamppfiles/include/mysql - I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _mysql.c -o  build/temp.macosx-10.6-universal-2.6/_mysql.o -mmacosx-version-min=10.4 -arch i386 -arch ppc  -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ - DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
In file included from _mysql.c:44:
/Applications/XAMPP/xamppfiles/include/mysql/my_config.h:1053:1: warning: "HAVE_WCSCOLL"  redefined
In file included from   /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:8,
             from _mysql.c:29:

/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h:803:1:警告:这是之前定义的位置_mysql.c:3131:致命错误:错误写入to -: Broken pipe 编译终止。lipo:无法打开输入文件:/var/tmp//ccQsr7Lk.out(没有这样的文件或目录)错误:命令“gcc-4.2”失败,退出状态为 1

4

1 回答 1

0

百胜安装mysql-devel

点安装 MySQL-python

于 2012-11-24T01:30:18.883 回答