启动scrapy shell时如何解决错误?

时间:2018-09-03 11:10:34

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

当我执行scrapy shell'https://scrapy.org'时,发生以下错误,我遵循了scrapy文档https://doc.scrapy.org/en/latest/topics/shell.html#launch-the-shell的指示

Traceback (most recent call last):
  File "/usr/local/bin/scrapy", line 11, in <module>
    sys.exit(execute())
  File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 150, in execute
    _run_print_help(parser, _run_command, cmd, args, opts)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 90, in _run_print_help
    func(*a, **kw)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 157, in _run_command
    cmd.run(args, opts)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/commands/shell.py", line 65, in run
    crawler = self.crawler_process._create_crawler(spidercls)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 203, in _create_crawler
    return Crawler(spidercls, self.settings)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 55, in __init__
    self.extensions = ExtensionManager.from_crawler(self)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 58, in from_crawler
    return cls.from_settings(crawler.settings, crawler)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/middleware.py", line 34, in from_settings
    mwcls = load_object(clspath)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/utils/misc.py", line 44, in load_object
    mod = import_module(module)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/extensions/memusage.py", line 16, in <module>
    from scrapy.mail import MailSender
  File "/usr/local/lib/python2.7/dist-packages/scrapy/mail.py", line 25, in <module>
    from twisted.internet import defer, reactor, ssl
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/ssl.py", line 230, in <module>
    from twisted.internet._sslverify import (
  File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_sslverify.py", line 15, in <module>
    from OpenSSL._util import lib as pyOpenSSLlib
ImportError: No module named _util

1 个答案:

答案 0 :(得分:1)

在草率安装中存在问题。也许可以帮忙:

sudo pip install pyopenssl --user --upgrade