我在Python 2.7上安裝了最新版本的Scrapy(是的,我仍然使用這個版本),並且在運行Scrapy的教程腳本時出現錯誤。 我跑的代碼是:使用Python的「Scrapy」錯誤
from scrapy.spider import BaseSpider
class DmozSpider(BaseSpider):
name = "dmoz.org"
allowed_domains = ["dmoz.org"]
start_urls = [
"http://www.dmoz.org/Computers/Programming/Languages/Python/Books/",
"http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/"
]
def parse(self, response):
filename = response.url.split("/")[-2]
open(filename, 'wb').write(response.body)
的錯誤是:
Traceback (most recent call last):
File "C:/Users/Rainey/Desktop/dmoz/spiders/dmoz_spider.py", line 1, in <module>
from scrapy.spider import BaseSpider
File "C:\Python27\lib\site-packages\scrapy\spider.py", line 7, in <module>
from scrapy import log
File "C:\Python27\lib\site-packages\scrapy\log.py", line 10, in <module>
from twisted.python import log
ImportError: No module named twisted.python
教程腳本是我的桌面上。這種效果是否可以,我應該在不同的地方嗎?
Zope接口https://pypi.python.org/pypi/zope.interface#download – fedmich 2013-03-26 10:58:07