gpt4 book ai didi

python - scrapy教程运行爬虫时出错

转载 作者:太空宇宙 更新时间:2023-11-03 18:49:41 24 4
gpt4 key购买 nike

我正在尝试运行 scrapy 教程,但每次尝试运行时都会收到此错误:

PALOMARESR-LALM:scrapy_tutorial brian$ scrapy crawl dmoz
2013-09-06 17:48:51-0700 [scrapy] INFO: Scrapy 0.18.2 started (bot: scrapy_tutorial)
2013-09-06 17:48:51-0700 [scrapy] DEBUG: Optional features available: ssl, http11
2013-09-06 17:48:51-0700 [scrapy] DEBUG: Overridden settings: {'NEWSPIDER_MODULE': 'scrapy_tutorial.spiders', 'SPIDER_MODULES': ['scrapy_tutorial.spiders'], 'BOT_NAME': 'scrapy_tutorial'}
2013-09-06 17:48:51-0700 [scrapy] DEBUG: Enabled extensions: LogStats, TelnetConsole, CloseSpider, WebService, CoreStats, SpiderState
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 5, in <module>
pkg_resources.run_script('Scrapy==0.18.2', 'scrapy')
File "build/bdist.macosx-10.8-intel/egg/pkg_resources.py", line 492, in run_script

File "build/bdist.macosx-10.8-intel/egg/pkg_resources.py", line 1350, in run_script
for name in eagers:
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/EGG-INFO/scripts/scrapy", line 4, in <module>
execute()
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/cmdline.py", line 142, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/cmdline.py", line 88, in _run_print_help
func(*a, **kw)
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/cmdline.py", line 149, in _run_command
cmd.run(args, opts)
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/commands/crawl.py", line 50, in run
self.crawler_process.start()
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/crawler.py", line 93, in start
if self.start_crawling():
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/crawler.py", line 168, in start_crawling
return self.start_crawler() is not None
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/crawler.py", line 151, in start_crawler
crawler.configure()
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/crawler.py", line 45, in configure
self.engine = ExecutionEngine(self, self._spider_closed)
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/core/engine.py", line 62, in __init__
self.downloader = Downloader(crawler)
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/core/downloader/__init__.py", line 73, in __init__
self.handlers = DownloadHandlers(crawler)
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/core/downloader/handlers/__init__.py", line 18, in __init__
cls = load_object(clspath)
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/utils/misc.py", line 38, in load_object
mod = __import__(module, {}, {}, [''])
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/core/downloader/handlers/s3.py", line 4, in <module>
from .http import HTTPDownloadHandler
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/core/downloader/handlers/http.py", line 5, in <module>
from .http11 import HTTP11DownloadHandler as HTTPDownloadHandler
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/core/downloader/handlers/http11.py", line 13, in <module>
from scrapy.xlib.tx import Agent, ProxyAgent, ResponseDone, \
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/xlib/tx/__init__.py", line 6, in <module>
from . import client, endpoints
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/xlib/tx/client.py", line 37, in <module>
from .endpoints import TCP4ClientEndpoint, SSL4ClientEndpoint
File "/Library/Python/2.7/site-packages/Scrapy-0.18.2-py2.7.egg/scrapy/xlib/tx/endpoints.py", line 222, in <module>
interfaces.IProcessTransport, '_process')):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/zope/interface/declarations.py", line 495, in __call__
raise TypeError("Can't use implementer with classes. Use one of "
TypeError: Can't use implementer with classes. Use one of the class-declaration functions instead.

我在 OS X 上运行,scrapy 版本信息如下:

PALOMARESR-LALM:~ brian$ scrapy version -v
Scrapy : 0.18.2
lxml : 3.2.3.0
libxml2 : 2.7.8
Twisted : 12.0.0
Python : 2.7.2 (default, Oct 11 2012, 20:14:37) - [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
Platform: Darwin-12.4.0-x86_64-i386-64bit

有人可以帮忙吗?提前致谢!

最佳答案

查看this问题。

或者运行此命令来更新 zope:

sudo pip install --upgrade zope.interface

关于python - scrapy教程运行爬虫时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18668696/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com