推荐学习书目
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 · 9557 views
    This topic created in 4053 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
        1
    binux  
       May 4, 2015
    STATIC_DEPS=true sudo pip install lxml
    redhatping
        2
    redhatping  
    OP
       May 4, 2015
    @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
        3
    binux  
       May 4, 2015
    那就 xcode-select
    redhatping
        4
    redhatping  
    OP
       May 4, 2015
    @binux 可以说清楚些吗?? 到底怎么回事啊,pyspider在安装lxml出了问题,按照
    redhatping
        5
    redhatping  
    OP
       May 4, 2015
    export CFLAGS=-Qunused-arguments
    export CPPFLAGS=-Qunused-arguments

    没用 ;),谢谢了
    redhatping
        6
    redhatping  
    OP
       May 4, 2015
    env ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install lxml
    也没用, 我晕, 真是xcode原因,怎么办啊。
    redhatping
        7
    redhatping  
    OP
       May 4, 2015
    用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
        8
    redhatping  
    OP
       May 4, 2015
    是不是没有安装 : libxml2 and libxslt的原因,但是pip install,没有啊
    ericls
        9
    ericls  
       May 4, 2015   ❤️ 1
    @redhatping

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

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

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

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

    brew 是什么都不懂。。。

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

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

    那就 xcode-select 咯

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