【问题标题】:Installing lxml OSX Mavericks 10.9.2安装 lxml OSX Mavericks 10.9.2
【发布时间】:2014-04-29 13:18:43
【问题描述】:

我正在尝试在 10.9.2 Mavericks 上安装 lxml,并且我使用了之前提到的所有解决方案 here 但我似乎得到了一个不同的错误,参数“-mno-fused-madd”是未知的,我相信它刚刚触发了一个警告,但现在它抛出了一个错误,这是日志

cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -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 -arch x86_64 -arch i386 -pipe -I/usr/include/libxml2 -I/Users/workspace/mybooktype/build/lxml/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.9-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace

clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

error: command 'cc' failed with exit status 1

更新 1 我最初试图安装 django 应用程序booktype 所以按照我首先尝试的说明进行操作

pip install lxml --install-option="--with-xml2-config=/usr/local/Cellar/libxml2/2.8.0/bin/xml2-config"

【问题讨论】:

    标签: python macos lxml osx-mavericks cc


    【解决方案1】:

    您应该为 xcode 安装或升级命令行工具。请在终端尝试命令:

    xcode-select --install
    

    【讨论】:

    • 我已经尝试过了,但没有成功,问题出在我使用的 python 版本中,我现在使用的是 2.7.6。感谢您的帮助
    【解决方案2】:

    所以问题与C编译器无关,是在机器上使用的python版本,显然python版本有冲突,新的干净安装python解决了问题,.bash_profile .然后我们使用原来的命令

    pip install lxml
    

    安装成功

    【讨论】:

    • 使用 HomeBrew 安装新的 python