错误:命令'cc'失败,退出状态1 - MAC上的MySQLdb安装

时间:2014-02-07 21:51:54

标签: python mysql-python

我是Mac的新手,我正在尝试在MAC上安装MySQLdb for Python但是在按照http://www.tutorialspoint.com/python/python_database_access.htm上提到的步骤后,我在运行后收到错误

$ python setup.py build

错误:

clang: warning: argument unused during compilation: '-mno-fused-madd'
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
     ^
1 error generated.
error: command 'cc' failed with exit status 1

注意:我的“mysql_config”路径是/ Applications / MAMP / Library / bin / mysql_config 我该怎么办?

2 个答案:

答案 0 :(得分:9)

问题是传递给编译器的未使用的参数。在运行构建代码之前尝试此操作:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

答案 1 :(得分:2)

在执行前尝试在终端上设置:

export CC='/usr/bin/gcc'
export CFLAGS='-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -I/opt/X11/include -arch i386 -arch x86_64'
export LDFLAGS='-arch i386 -arch x86_64'
export ARCHFLAGS='-arch i386 -arch x86_64'

在此处找到:https://jamesfriend.com.au/installing-pygame-python-mac-os-108-mountain-lion