首页 > 解决方案 > 如何在 Windows 上的可视化代码中为 python 安装 scrapy?

问题描述

我想用可视化代码中的python进行开发,如何在windows上的可视化代码中安装scrapy for python?

import scrapy


class SafetyCaseItem(scrapy.Item):
    # define the fields for your item here like:
    # name = scrapy.Field()
    casetitle = scrapy.Field()
    casetype = scrapy.Field()
    posttime = scrapy.Field()
    caseurl = scrapy.Field()
    description = scrapy.Field()
    casecontent = scrapy.Field()
    ipage = scrapy.Field()
    nextlink = scrapy.Field()

标签: pythonvisual-studio-codescrapy

解决方案


首先打开你的命令提示符;

然后转到您的当前目录;

cd path_of_your_folder

cd表示选择目录。

然后运行这个命令;

pip install scrapy

这就对了。你现在准备好了。

例如,如果您的项目目录是 my_project 并且位于该Users/your_username_on_your_computer目录内,那么在您的命令提示符下(您将在该C:/Users/your_username_on_your_computer位置),键入;

cd my_project

然后按回车。

现在您位于要使用scrapy 的my_project 目录中。

所以现在在你的命令提示符下运行这个命令;

pip install scrapy

你现在完成了。开始写一些代码。


推荐阅读