pip install lxml 出错,怎么解决?

2014-03-21 15:25:02 +08:00
 kchum
Mac os x 10.9.2

提示错误如下:
creating build/temp.macosx-10.9-intel-2.7/src

creating build/temp.macosx-10.9-intel-2.7/src/lxml

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/private/var/folders/22/f2h4btc90jncdy3p1sq_td0m0000gn/T/pip_build_KentChum/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

搜索过,安装了command line tool,也export cc='gcc'了,没用。
代码安装python setup.py,或者brew install lxml都是这个错误
6857 次点击
所在节点    Python
7 条回复
heqing
2014-03-21 15:35:36 +08:00
binux
2014-03-21 15:40:49 +08:00
brew
kchum
2014-03-21 16:27:18 +08:00
@heqing 在lxml源代码目录的setup.cfg加入了[build_ext] compiler=icc,命令运行
sudo python setup.py build --static-deps --libxml2-version=2.9.1 --libxslt-version=1.1.28
同样出现
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


@binux 我是用brew install libxml2 libxslt了,上面有笔误。不知道你所说的是什么意思,麻烦指点下,谢谢。
binux
2014-03-21 16:40:50 +08:00
rockhead
2014-03-21 16:45:13 +08:00
给Xcode设置环境变量:
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

新版的xcode 检查更严格了,没有使用的命令行参数会当成错误处理
rockhead
2014-03-21 16:56:50 +08:00
单行命令如下:

env ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install lxml
kchum
2014-03-21 17:15:47 +08:00
@heqing
@binux
@rockhead 感谢大家,如 @rockhead 所写的一样,已安装上。
我这Cannot fetch index base URL https://pypi.python.org/simple/
所以用v2的源
env ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install lxml -i http://pypi.v2ex.com/simple

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/105281

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX