cc1:错误:在mac 10.7.5上安装python-mysql时无法识别的命令行选项“-Wno-null-conversion”

时间:2013-04-21 02:55:21

标签: python mysql macos python-2.7 mysql-python

此错误打破了Mac 10.7.5上的python-mysql安装。以下是步骤

  1. 安装的python是2.7.1,mysql是64位,用于5.6.11。
  2. 正在安装的python-mysql是1.2.4,也尝试过1.2.3
  3. 安装配置

    1) sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql
    2) Edit the setup_posix.py and change the following mysql_config.path = "mysql_config" to mysql_config.path = "/usr/local/mysql/bin/mysql_config" 
    3) sudo python setup.py build
    
  4. 这是构建的堆栈跟踪

    running build
    running build_py
    copying MySQLdb/release.py -> build/lib.macosx-10.7-intel-2.7/MySQLdb
    running build_ext
    building '_mysql' extension
    llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,4,'final',1) -D__version__=1.2.4 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -Wno-null-conversion -Os -g -fno-strict-aliasing -arch x86_64
    cc1: error: unrecognized command line option "-Wno-null-conversion"
    error: command 'llvm-gcc-4.2' failed with exit status 1
    

    欢迎您的建议和想法。感谢。

2 个答案:

答案 0 :(得分:26)

尝试删除

中的cflags -Wno-null-conversion -Wno-unused-private-field
/usr/local/mysql/bin/mysql_config.

像:

cflags="-I$pkgincludedir  -Wall   -Os -g -fno-strict-aliasing -DDBUG_OFF -arch x86_64 " #note: end space!

答案 1 :(得分:0)

哇,我已经花了几个小时的时间来安装MySQL-python'安装MySQL-python'。我一直在重新安装Xcode 4.6.3,Xcode命令行工具(在Mac OS X 10.7.5上),并安装Kenneth Reitz'东西(https://github.com/kennethreitz/osx-gcc-installer)在我......的时候无济于事。

改变cflags选项终于有所帮助了!

谢谢!