AttributeError: 'Selector' object has no attribute '_default_type'

111 阅读1分钟

场景

在Scrapy中尝试使用xpath时遇到该错误 scrapy版本1.5.1

解决方案

降低parsel版本到1.7.0 pip install parsel==1.7.0

分析

parsel 1.8.0版本删除了 attribute '_default_type' 参见 stackoverflow.com/questions/7…