我正在尝试运行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
有人可以帮忙吗?提前谢谢!
答案 0 :(得分:1)
答案 1 :(得分:0)
这是我的环境,我可以毫无问题地运行scrapy crawl dmoz。 (dmoz源代码可以在这里找到https://github.com/scrapy/dirbot)
$ Scrapy version -v
Scrapy : 0.18.2
lxml : 3.2.3.0
libxml2 : 2.7.8
Twisted : 13.1.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
也许您可以像这样使用点击更新
pip install --upgrade Scrapy
答案 2 :(得分:0)
尝试更新python(不是3)或pip版本