执行python-scrappy模块时出错

时间:2011-12-29 17:25:18

标签: python web-scraping scrapy

我在执行python-scrappy示例模块时遇到错误

我的Stacktrace:

 gridlex@gridlex-laptop:~/Documents/tutorial$ scrapy crawl tutorial/dmoz

 /usr/lib/python2.6/dist-packages/zope/__init__.py:3: UserWarning: Module twisted was   already imported from /usr/lib/python2.6/dist-packages/twisted/__init__.pyc, but /usr/local/  lib/python2.6/dist-packages is being added to sys.path
 import pkg_resources
 2011-12-29 22:47:04+0530 [scrapy] INFO: Scrapy 0.14.0.2841 started (bot: tutorial)
 Traceback (most recent call last):
 File "/usr/local/bin/scrapy", line 4, in <module>
   execute()
 File "/usr/local/lib/python2.6/dist-packages/scrapy/cmdline.py", line 132, in execute
   _run_print_help(parser, _run_command, cmd, args, opts)
 File "/usr/local/lib/python2.6/dist-packages/scrapy/cmdline.py", line 97, in       _run_print_help
 func(*a, **kw)
File "/usr/local/lib/python2.6/dist-packages/scrapy/cmdline.py", line 139, in _run_command
  cmd.run(args, opts)
File "/usr/local/lib/python2.6/dist-packages/scrapy/commands/crawl.py", line 43, in run
   spider = self.crawler.spiders.create(spname, **opts.spargs)
File "/usr/local/lib/python2.6/dist-packages/scrapy/command.py", line 34, in crawler
   self._crawler.configure()
File "/usr/local/lib/python2.6/dist-packages/scrapy/crawler.py", line 34, in configure
   self.extensions = ExtensionManager.from_crawler(self)
File "/usr/local/lib/python2.6/dist-packages/scrapy/middleware.py", line 48, in   from_crawler
   return cls.from_settings(crawler.settings, crawler)
File "/usr/local/lib/python2.6/dist-packages/scrapy/middleware.py", line 29, in   from_settings
  mwcls = load_object(clspath)
File "/usr/local/lib/python2.6/dist-packages/scrapy/utils/misc.py", line 39, in load_object
  raise ImportError, "Error loading object '%s': %s" % (path, e)
ImportError: Error loading object 'scrapy.telnet.TelnetConsole': No module named conch

我正在使用python-scrappy模块

执行示例报废

我用这个例子执行它http://doc.scrapy.org/en/0.14/intro/tutorial.html#intro-tutorial

2 个答案:

答案 0 :(得分:13)

Debian或Ubuntu(9.04或更早版本)

如果您正在运行Debian Linux,请以root身份运行以下命令:

apt-get install python-twisted python-libxml2 python-pyopenssl python-simplejson

然后:

easy_install -U w3lib

然后按照Install Scrapy中的说明进行操作。

答案 1 :(得分:2)

我认为您需要安装twisted,因为找不到的conch模块可能是twisted.conch