ModuleNotFoundError: 没有名为“Scrapy"的模块 [英] ModuleNotFoundError: No module named 'Scrapy'

查看:92
本文介绍了ModuleNotFoundError: 没有名为“Scrapy"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导入 Scrapy类 NgaSpider(Scrapy.Spider):name = "NgaSpider"主机 = "http://bbs.ngacn.cc/"start_urls = ["http://bbs.ngacn.cc/thread.php?fid=406",]定义解析(自我,响应):打印(response.body")

<小时>

错误:ModuleNotFoundError: 没有名为Scrapy"的模块

如何解决这个问题?

解决方案

您错误地导入了 scrapy 模块.

此处查找简单的教程和参考.>

您必须进行以下更改:

import scrapy #这里改class NgaSpider(scrapy.Spider): # 这里也要改name = "NgaSpider"主机 = "http://bbs.ngacn.cc/"start_urls = ["http://bbs.ngacn.cc/thread.php?fid=406",]定义解析(自我,响应):打印(response.body")

<块引用>

假设您使用的是 1.3 版本.

检查使用

pip show scrapy

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?

解决方案

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

这篇关于ModuleNotFoundError: 没有名为“Scrapy"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆