【问题标题】:How to upgrade scrapy如何升级scrapy
【发布时间】:2018-05-03 09:04:46
【问题描述】:

我正在尝试将 scrapy 升级到最新版本 ( 1.4 ) 但我收到此错误:

# sudo pip install --upgrade scrapy
Downloading/unpacking scrapy from https://pypi.python.org/packages/a8/96/3affe11cf53a5d2105536919113d5b453479038bb486f7387f4ce4a3b83f/Scrapy-1.4.0-py2.py3-none-any.whl#md5=a14b1766ca0277a846ff4b01bb81ff9b
  Downloading Scrapy-1.4.0-py2.py3-none-any.whl (248kB): 248kB downloaded
Downloading/unpacking pyOpenSSL from https://pypi.python.org/packages/24/37/89bf12e53f1d27e8b2c8e5f8f9c7a958a3905f6916a9294a57a9d83fa165/pyOpenSSL-17.3.0-py2.py3-none-any.whl#md5=4217027ddfa4182d7f3b425d0b5eac92 (from scrapy)
  Downloading pyOpenSSL-17.3.0-py2.py3-none-any.whl (51kB): 51kB downloaded
Downloading/unpacking six>=1.5.2 from https://pypi.python.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl#md5=866ab722be6bdfed6830f3179af65468 (from scrapy)
  Downloading six-1.11.0-py2.py3-none-any.whl
Requirement already up-to-date: queuelib in /usr/lib/python2.7/dist-packages (from scrapy)
Requirement already up-to-date: service-identity in /usr/local/lib/python2.7/dist-packages (from scrapy)
Downloading/unpacking w3lib>=1.17.0 (from scrapy)
  Downloading w3lib-1.18.0-py2.py3-none-any.whl
Downloading/unpacking parsel>=1.1 (from scrapy)
  Downloading parsel-1.2.0-py2.py3-none-any.whl
Downloading/unpacking PyDispatcher>=2.0.5 (from scrapy)
  Downloading PyDispatcher-2.0.5.tar.gz
  Running setup.py (path:/tmp/pip_build_root/PyDispatcher/setup.py) egg_info for package PyDispatcher

    warning: no previously-included files matching '*.bat' found anywhere in distribution
    warning: no previously-included files matching './CVS' found anywhere in distribution
    warning: no previously-included files matching '.cvsignore' found anywhere in distribution
Downloading/unpacking cssselect>=0.9 from https://pypi.python.org/packages/1d/e5/f1d410192e34b1034dba7804de5dbcdece20a883c445ad661e5ea8226b42/cssselect-1.0.1-py2.py3-none-any.whl#md5=ff41f11fc64a09aa44eb1111f68942f9 (from scrapy)
  Downloading cssselect-1.0.1-py2.py3-none-any.whl
Downloading/unpacking lxml from https://pypi.python.org/packages/e1/4c/d83979fbc66a2154850f472e69405572d89d2e6a6daee30d18e83e39ef3a/lxml-4.1.1.tar.gz#md5=0265ad6701951347f2dbbb470e3d1512 (from scrapy)
  Downloading lxml-4.1.1.tar.gz (2.4MB): 2.4MB downloaded
  Running setup.py (path:/tmp/pip_build_root/lxml/setup.py) egg_info for package lxml
    Building lxml version 4.1.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.28

    warning: no previously-included files found matching '*.py'
    warning: no files found matching '*.html' under directory 'doc'
Downloading/unpacking Twisted>=13.1.0 from https://pypi.python.org/packages/a2/37/298f9547606c45d75aa9792369302cc63aa4bbcf7b5f607560180dd099d2/Twisted-17.9.0.tar.bz2#md5=6dbedb918f0c7288a4c670f59393ecf8 (from scrapy)
  Downloading Twisted-17.9.0.tar.bz2 (3.0MB): 3.0MB downloaded
  Running setup.py (path:/tmp/pip_build_root/Twisted/setup.py) egg_info for package Twisted
    no previously-included directories found matching '.travis'
    no previously-included directories found matching 'tests'
    warning: no previously-included files found matching 'examplesetup.py'
    no previously-included directories found matching 'src/exampleproj'
    no previously-included directories found matching 'src/incremental/newsfragments'

    Installed /tmp/pip_build_root/Twisted/incremental-17.5.0-py2.7.egg

    warning: no previously-included files matching '*.misc' found under directory 'src/twisted'
    warning: no previously-included files matching '*.bugfix' found under directory 'src/twisted'
    warning: no previously-included files matching '*.doc' found under directory 'src/twisted'
    warning: no previously-included files matching '*.feature' found under directory 'src/twisted'
    warning: no previously-included files matching '*.removal' found under directory 'src/twisted'
    warning: no previously-included files matching 'NEWS' found under directory 'src/twisted'
    warning: no previously-included files matching 'README' found under directory 'src/twisted'
    warning: no previously-included files matching 'newsfragments' found under directory 'src/twisted'
    warning: no previously-included files found matching 'src/twisted/topfiles/CREDITS'
    warning: no previously-included files found matching 'src/twisted/topfiles/ChangeLog.Old'
    warning: no previously-included files found matching 'pyproject.toml'
    warning: no previously-included files found matching 'codecov.yml'
    warning: no previously-included files found matching 'appveyor.yml'
    no previously-included directories found matching 'bin'
    no previously-included directories found matching 'admin'
    no previously-included directories found matching '.travis'
    warning: no previously-included files found matching 'docs/historic/2003'
    warning: no previously-included files matching '*' found under directory 'docs/historic/2003'
Downloading/unpacking cryptography>=1.9 (from pyOpenSSL->scrapy)
  Downloading cryptography-2.1.3.tar.gz (441kB): 441kB downloaded
  Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography
    error in cryptography setup command: Invalid environment marker: python_version < '3'
    Complete output from command python setup.py egg_info:
    error in cryptography setup command: Invalid environment marker: python_version < '3'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography
Storing debug log for failure in /root/.pip/pip.log

为什么?

【问题讨论】:

  • 看看这个error in cryptography setup command: Invalid environment marker: python_version &lt; '3' 。也许cryptography 不支持python-2.x
  • @Silencer 那么我需要 python 3 吗?
  • 我不这么认为。这应该是pip分析的问题extras_require
  • 我确实更新了scrapy(Ubuntu 16.04 上的 py3),没关系。
  • 不支持 python 2.x

标签: python python-2.7 web-scraping scrapy web-crawler


【解决方案1】:

通过升级python解决:

apt-get upgrade python

然后通过运行这些命令重新安装scrapy:

sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev    
pip install scrapy

更多信息请见here

【讨论】:

    猜你喜欢
    • 2016-12-01
    • 2017-12-13
    • 2015-04-15
    • 2016-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多