V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
kchum
V2EX  ›  Python

pip install lxml 出错,怎么解决?

  •  
  •   kchum · 2014-03-21 15:25:02 +08:00 · 6849 次点击
    这是一个创建于 3693 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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都是这个错误
    第 1 条附言  ·  2014-03-21 17:16:49 +08:00
    env ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install lxml -i http://pypi.v2ex.com/simple

    即可安装,确实最近update了Xcode.
    7 条回复    1970-01-01 08:00:00 +08:00
    binux
        2
    binux  
       2014-03-21 15:40:49 +08:00   ❤️ 1
    brew
    kchum
        3
    kchum  
    OP
       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
        4
    binux  
       2014-03-21 16:40:50 +08:00   ❤️ 1
    rockhead
        5
    rockhead  
       2014-03-21 16:45:13 +08:00   ❤️ 1
    给Xcode设置环境变量:
    ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future

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

    env ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install lxml
    kchum
        7
    kchum  
    OP
       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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2532 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 11:31 · PVG 19:31 · LAX 04:31 · JFK 07:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.