2013-04-21 241 views
9

这个错误破坏了我在Mac 10.7.5上的python-mysql安装。以下是步骤cc1:error:无法识别的命令行选项“-Wno-null-conversion”在Mac上安装python-mysql 10.7.5

  1. 安装的python是2.7.1,对于5.6.11,mysql是64位。
  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 
    

这里是构建

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 

堆栈跟踪欢迎您的建议和想法。谢谢。

回答

26

尝试在

/usr/local/mysql/bin/mysql_config. 

删除cflags -Wno-null-conversion -Wno-unused-private-field像:

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

删除它们,安装成功。抛出的新错误,“Python mysqldb:Library not loaded:libmysqlclient.18.dylib”用此线程解决http://stackoverflow.com/questions/6383310/python-mysqldb-library-not-loaded-libmysqlclient-18-dylib – Joseph 2013-04-22 07:31:15

+0

这解决了我的问题,并尝试安装mysql2 gem。我在gem/mysql2-0.3.11/ext/mysql/mkmf.log中查找并发现相同的错误。删除-Wno-null转换和-Wno-unused-private-field使其无w/o问题。现在我只希望我知道他们做了什么......另外,因为我使用自制软件安装mysql,所以我的mysql_config位于:/usr/local/Cellar/mysql/5.6.12/bin/mysql_config – 2013-06-27 15:37:59

0

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

Altering cflags选项终于有了帮助!

谢谢!

相关问题