[英]scrapy import itemloaders ModuleNotFoundError: No module named 'itemloaders'
I had a scrapy project working with version 2.0 but when I upgraded to version 2.4 I am getting the above error.我有一个使用 2.0 版的 scrapy 项目,但是当我升级到 2.4 版时,出现上述错误。
It seems the be failing in the init.py file below: \\Anaconda3\\lib\\site-packages\\scrapy\\loader_ init _.py下面的 init.py 文件似乎失败了:\\Anaconda3\\lib\\site-packages\\scrapy\\loader_ init _.py
on this import line which didn't exist in version 2.0:在这个 2.0 版中不存在的导入行上:
import itemloaders
Any ideas why?任何想法为什么?
Itemloader changed in scrapy 2.3项目加载器在scrapy 2.3 中发生了变化
From scrapy v.2.3 release notes :从scrapy v.2.3 发行说明:
The base implementation of item loaders has been moved into a separate library, itemloaders , allowing usage from outside Scrapy and a separate release schedule
项目加载器的基本实现已移入单独的库itemloaders ,允许从 Scrapy 外部使用和单独的发布时间表
It is given in the documentation example about Item Loaders.它在关于项目加载器的文档示例中给出。 You have to import ItemLoader from scrapy.loader.
你必须从scrapy.loader 导入ItemLoader。 Link : https://docs.scrapy.org/en/latest/topics/loaders.html
链接: https : //docs.scrapy.org/en/latest/topics/loaders.html
As the previous comments say, it's all laid out in the documentation.正如之前的评论所说,这一切都在文档中列出。 That being said, I changed the following import statement
话虽如此,我更改了以下导入语句
from scrapy.loader import ItemLoader
to到
from itemloaders import ItemLoader
and it worked.它奏效了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.