我试图在https://doc.scrapy.org/en/1.3/intro/tutorial.html上运行示例,当我使用scrapy抓取引号运行蜘蛛时,我收到错误:
ModuleNotFoundError:没有名为' _sqlite3'
的模块我在使用python 3.6的virtualenv中运行,如何修复错误以运行我的脚本?感谢
更新
脚本是:
import scrapy
class QuotesSpider(scrapy.Spider):
name = "quotes"
def start_requests(self):
urls = [
'http://quotes.toscrape.com/page/1/',
'http://quotes.toscrape.com/page/2/',
]
for url in urls:
yield scrapy.Request(url=url, callback=self.parse)
def parse(self, response):
page = response.url.split("/")[-2]
filename = 'quotes-%s.html' % page
with open(filename, 'wb') as f:
f.write(response.body)
self.log('Saved file %s' % filename)
答案 0 :(得分:0)
尝试:
sudo apt-get install libsqlite3-dev