推荐学习书目
› 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
redhatping
V2EX  ›  Python

安装 pyspider 出错,错误日志已经贴上来,大家帮忙看看,谢谢。

  •  
  •   redhatping · May 4, 2015 · 9946 views
    This topic created in 4207 days ago, the information mentioned may be changed or developed.
    环境:mac 10.10.3 python 2.7


    sudo pip install pyspider


    1 error generated.
    error: command 'cc' failed with exit status 1

    ----------------------------------------
    Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-rQTT_8/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PLFb70-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-rQTT_8/lxml


    谢谢了。
    22 replies  •  2015-07-17 17:19:31 +08:00
    binux
    binux
    May 4, 2015
    1
    STATIC_DEPS=true sudo pip install lxml
    redhatping
    redhatping
    OP
    May 4, 2015
    2
    @binux error: command 'cc' failed with exit status 1

    ----------------------------------------
    Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-0syUSb/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-b0HQ2W-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-0syUSb/lxml

    安装了你说的,lxml,一样出错了,是不是更新了xcode的原因?
    binux
    binux
    May 4, 2015
    3
    那就 xcode-select
    redhatping
    redhatping
    OP
    May 4, 2015
    4
    @binux 可以说清楚些吗?? 到底怎么回事啊,pyspider在安装lxml出了问题,按照
    redhatping
    redhatping
    OP
    May 4, 2015
    5
    export CFLAGS=-Qunused-arguments
    export CPPFLAGS=-Qunused-arguments

    没用 ;),谢谢了
    redhatping
    redhatping
    OP
    May 4, 2015
    6
    env ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install lxml
    也没用, 我晕, 真是xcode原因,怎么办啊。
    redhatping
    redhatping
    OP
    May 4, 2015
    7
    用easy_install发现:
    /private/tmp/pip-build-feNg8E/lxml/src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found

    头文件没发现,这装个lxml。。。头大
    redhatping
    redhatping
    OP
    May 4, 2015
    8
    是不是没有安装 : libxml2 and libxslt的原因,但是pip install,没有啊
    ericls
    ericls
    May 4, 2015❤️1
    9
    @redhatping

    brew install libxml2
    brew install libxslt
    brew link libxml2 --force
    brew link libxslt --force

    pip install lxml
    binux
    binux
    May 4, 2015 via Android❤️1
    10
    @redhatping 你自己搜索一下不就知道了
    redhatping
    redhatping
    OP
    May 4, 2015
    11
    楼上正确, 总算解决来, 原来是缺失这两个库。。 把我累的。
    aszxqw
    aszxqw
    May 4, 2015
    12
    @redhatping 目测似乎你不知道你的楼上就是pyspider的作者吧。。。。
    redhatping
    redhatping
    OP
    May 4, 2015
    13
    确实不知道, 😓, 通过这一次pyspider的安装, 五个小时的折腾 , 总算弄明白。

    pyspider--依赖python包---lxml ---- 依赖于系统包 ,libxm2,libxslt. ( 为什么不能一条龙呢?)

    至于系统包是什么? 不懂 ,刚迁移到mac中。

    brew 是什么都不懂。。。

    谢谢大家了。
    proudzhu
    proudzhu
    May 4, 2015 via Android❤️1
    14
    因为库文件不是用 Python 写的啊
    binux
    binux
    May 4, 2015
    15
    @redhatping 你用 osx lxml 为关键词搜就能搜到这些方法。
    官方的 `STATIC_DEPS=true sudo pip install lxml` 会自动下载依赖,静态链接。

    一般缺库会报缺头文件,你又没有报
    #include "libxml/xmlversion.h"

    那就 xcode-select 咯

    反正我不信你把 log 贴全了,我不信你每次出错都是一样的。
    monsabre1
    monsabre1
    May 4, 2015
    16
    这程序代码比较垃圾
    试用了下 没法用 放弃了
    还是留别人浪费生命吧
    wibile
    wibile
    May 4, 2015
    17
    scrapy吧,成熟稳定一些,也全面。精神上支持pyspider
    donghouhe
    donghouhe
    May 4, 2015 via Android
    18
    我在mac安装lxml也失败,不过我选择的解决方法是改装虚拟机里,debian pip安装lxml很顺溜, 现在看来原来有这样的解决方法。
    redhatping
    redhatping
    OP
    May 4, 2015
    19
    嗯,没有贴全, 我后面用easy_install 安装, 很明显报错了, 缺头文件。
    于是brew。。。。
    现在成功了。
    redhatping
    redhatping
    OP
    May 4, 2015
    20
    @proudzhu 亲,因为是windows过来的, 完全搞不懂mac os 这一些的概念和命令, 网上搜索又比较杂,有没有这样的书籍购买, 彻底想补一下。 谢谢
    proudzhu
    proudzhu
    May 4, 2015
    21
    @redhatping 没用过 MacOS ,我用 linux 的,用着用着就知道这些概念了。。。
    echoer
    echoer
    Jul 17, 2015
    22
    很好的贴,我也遇到这个问题了。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   495 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 21:25 · PVG 05:25 · LAX 13:25 · JFK 16:25
    ♥ Do have faith in what you're doing.