Linux Server中的Scrapy KeyError,但不适用于Windows

时间:2017-02-17 03:20:41

标签: python linux amazon-web-services scrapy scrapy-spider

My Scrapy在我的本地计算机Windows上运行良好。然后我尝试在我的AWS Linux服务器上运行它,但我得到了这个

Traceback (most recent call last):
  File "run<spider_name>.py", line 12, in <module>
    spider_name).split())
  File "/usr/lib/python2.7/site-packages/scrapy/cmdline.py", line 142, in execute
    _run_print_help(parser, _run_command, cmd, args, opts)
  File "/usr/lib/python2.7/site-packages/scrapy/cmdline.py", line 88, in _run_print_help
    func(*a, **kw)
  File "/usr/lib/python2.7/site-packages/scrapy/cmdline.py", line 149, in _run_command
    cmd.run(args, opts)
  File "/usr/lib/python2.7/site-packages/scrapy/commands/crawl.py", line 57, in run
    self.crawler_process.crawl(spname, **opts.spargs)
  File "/usr/lib/python2.7/site-packages/scrapy/crawler.py", line 162, in crawl
    crawler = self.create_crawler(crawler_or_spidercls)
  File "/usr/lib/python2.7/site-packages/scrapy/crawler.py", line 190, in create_crawler
    return self._create_crawler(crawler_or_spidercls)
  File "/usr/lib/python2.7/site-packages/scrapy/crawler.py", line 194, in _create_crawler
    spidercls = self.spider_loader.load(spidercls)
  File "/usr/lib/python2.7/site-packages/scrapy/spiderloader.py", line 51, in load
    raise KeyError("Spider not found: {}".format(spider_name))
KeyError: 'Spider not found: <spider_name>'

为什么?如何在Linux服务器上运行它?

1 个答案:

答案 0 :(得分:0)

突然解决了,我迷惑了自己。

我通过使用pip install -r requirements.txt更新所有要求来解决此问题。我添加了Scrapy Splash以满足要求,我忘了安装它。