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

Posted

技术标签:

【中文标题】cc1:错误:在 mac 10.7.5 上安装 python-mysql 时无法识别命令行选项“-Wno-null-conversion”【英文标题】:cc1: error: unrecognized command line option "-Wno-null-conversion" within installing python-mysql on mac 10.7.5 【发布时间】:2013-04-14 04:43:42 【问题描述】:

这个错误破坏了我在 Mac 10.7.5 上的 python-mysql 安装。以下是步骤

    安装的python是2.7.1,mysql是5.6.11的64位。 正在安装的python-mysql是1.2.4,也试过1.2.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

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

【问题讨论】:

【参考方案1】:

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

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

谢谢!

【讨论】:

【参考方案2】:

尝试在

中删除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!

【讨论】:

删除它们,安装成功。抛出一个新错误,“Python mysqldb: Library not loaded: libmysqlclient.18.dylib” 用这个线程解决了***.com/questions/6383310/… 这解决了我的问题以及尝试安装 mysql2 gem。我查看了 gems/mysql2-0.3.11/ext/mysql/mkmf.log 并发现了同样的错误。删除 -Wno-null-conversion 和 -Wno-unused-private-field 使其工作没有问题。现在我只希望我知道他们做了什么......另外,由于我使用自制软件安装 mysql,我的 mysql_config 位于:/usr/local/Cellar/mysql/5.6.12/bin/mysql_config

以上是关于cc1:错误:在 mac 10.7.5 上安装 python-mysql 时无法识别命令行选项“-Wno-null-conversion”的主要内容,如果未能解决你的问题,请参考以下文章

ejabber 的 erl 文件在 mac os 10.7.5 上运行时给出错误“分段错误:11”

尝试在 Mac OS X 10.7.5 上的 usr/local/bin 中安装 composer

Mac OS 10.7.5用RVM安装ruby失败?是gcc的问题吗

Mac OS 10.7.5用RVM安装ruby失败?是gcc的问题吗

Windows - 使用 mingw 进行 pip 安装 - 失败 - cc1.exe:错误:无法识别的命令行选项“-mno-cygwin”

如何使用 FFMPEG 在 Mac 上开始直播?