ModuleNotFoundError: No module named 'Scrapy'

て烟熏妆下的殇ゞ 提交于 2020-01-02 10:22:24

问题


import Scrapy


class NgaSpider(Scrapy.Spider):
    name = "NgaSpider"
    host = "http://bbs.ngacn.cc/"
    start_urls = [
        "http://bbs.ngacn.cc/thread.php?fid=406",
    ]


    def parse(self, response):
        print ("response.body")

Error: ModuleNotFoundError: No module named 'Scrapy'

What is going on to fix this issue?


回答1:


You are incorrectly importing the scrapy module.

Find a simple tutorial and references from here.

You have to do the following changes:

import scrapy # Change here


class NgaSpider(scrapy.Spider): # Change here too
    name = "NgaSpider"
    host = "http://bbs.ngacn.cc/"
    start_urls = [
        "http://bbs.ngacn.cc/thread.php?fid=406",
    ]


    def parse(self, response):
        print ("response.body")

Assuming you are using 1.3 version of it.

To check use

pip show scrapy



来源:https://stackoverflow.com/questions/42967930/modulenotfounderror-no-module-named-scrapy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!