【问题标题】:Error when installing Scrapy on Ubuntu 13.04在 Ubuntu 13.04 上安装 Scrapy 时出错
【发布时间】:2013-07-10 18:49:20
【问题描述】:

当我尝试使用命令sudo easy_install -U Scrapy 在 ubuntu 13.04 上安装 Scrapy 时,我收到以下错误:

Searching for Scrapy
Reading pypi.python.org/simple/Scrapy/
Best match: Scrapy 0.16.5
Processing Scrapy-0.16.5-py2.7.egg
Scrapy 0.16.5 is already the active version in easy-install.pth
Installing scrapy script to /usr/local/bin

Using /usr/local/lib/python2.7/dist-packages/Scrapy-0.16.5-py2.7.egg
Processing dependencies for Scrapy
Searching for Twisted>=8.0
Reading pypi.python.org/simple/Twisted/
Best match: Twisted 13.1.0
Downloading pypi.python.org/packages/source/T/Twisted/Twisted-13.1.0.tar.bz2#md5=5609c91ed465f5a7da48d30a0e7b6960
Processing Twisted-13.1.0.tar.bz2
Writing /tmp/easy_install-xYafJF/Twisted-13.1.0/setup.cfg
Running Twisted-13.1.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-xYafJF/Twisted-13.1.0/egg-dist-tmp-ybetxt
twisted/runner/portmap.c:10:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

我也尝试了pip install Scrapy 命令,但我再次收到相同的错误x86_64-linux-gnu-gcc

您能帮我在 Ubuntu 13.04 上安装 Scrapy 吗?

【问题讨论】:

  • 是的,我得到了“gcc 版本 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)”
  • 官方scrapy网站不推荐这个。 “不要使用 Ubuntu 提供的 python-scrapy 包,它们通常太旧且速度慢,无法赶上最新的 Scrapy。”
  • 是的。它给出了同样的错误。 “错误:命令 'x86_64-linux-gnu-gcc' 失败,退出状态为 1” “命令 /usr/bin/python -c “import setuptools;__file__='/tmp/pip-build-brk/Twisted/setup.py ';exec(compile(open(file).read().replace('\r\n', '\n'), file, 'exec') )" install --record /tmp/pip-aiQgfx-record/install-record.txt --single-version-externally-managed failed with error code 1 in /tmp/pip-build-brk/Twisted"
  • 你安装了python dev吗?
  • 非常感谢。安装“python2.7-dev”后,我成功安装了Scrapy

标签: ubuntu scrapy pip easy-install


【解决方案1】:

为了安装scrapy,你需要先安装python dev。

【讨论】:

  • 这应该列为要求:pypi.python.org/pypi/Scrapy 如果是要求。对我来说,当然是。
  • 在我的情况下,“libxslt1-dev”也丢失了
  • 这对我没有帮助。我有以下错误: python-dev : Depends: libpython-dev (= 2.7.4-0ubuntu1) 但它不会被安装 Depends: python2.7-dev (>= 2.7.4-1~) 但它不会安装 N:忽略目录“/etc/apt/sources.list.d/”中的文件“canonical”,因为它没有文件扩展名 N:忽略目录“/etc/apt/sources”中的文件“canonical” .list.d/',因为它没有文件扩展名 E:无法纠正问题,您持有损坏的包
【解决方案2】:

对我来说,我安装了 python dev 但仍然无法工作(尝试安装加密时失败),我发现 this stack overflow 帖子说运行此命令以确保安装所有依赖项

sudo apt-get install build-essential libssl-dev libffi-dev python-dev libxml2-dev

这对我有用

【讨论】:

  • 安装这些软件包后,它对我有用:libssl-doc、libssl-dev、libxml2-dev。我仍然不确定它们是否是多余的。
【解决方案3】:

我在尝试在 DigitalOcean 液滴上安装 Scrapy 时遇到了完全相同的问题,这不是库问题,显然它可能发生在低 RAM 盒子中,您可以通过结合 ionice + pip 来解决它:

sudo ionice -c3 pip install Scrapy

【讨论】:

    【解决方案4】:

    使用这个:sudo apt-get install libssl-dev

    在安装scrapy之前。 然后

    sudo pip install scrapy --force --upgrade

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-25
      • 1970-01-01
      • 1970-01-01
      • 2013-05-12
      • 2013-08-20
      相关资源
      最近更新 更多