Unknown command: crawl

Use "scrapy" to see available commands

1.使用命令行方式cmd,是因为没有cd到项目的根目录,crawl会去搜索cmd目录下的scrapy.cfg文件。
官方文档中也进行了说明:http://scrapy-chs.readthedocs.io/zh_CN/0.24/topics/commands.html

2.使用的PyCharm来进行运行的时候,,我们所处的位置本来就是项目的根目录,而这个时候还是报错误的话,那就不是没有进入根目录的问题了,而是其他原因。

“no active project”

在使用命令行startproject的时候,会自动生成scrapy.cfg,因为这个项目文件中只有代码,没有配置文件,或者配置文件被移去其他位置了,导致报错。

解决方案:找一个配置文件,修改为如下格式, 

# Automatically created by: scrapy startproject 
# 
# For more information about the [deploy] section see: 
# https://scrapyd.readthedocs.io/en/latest/deploy.html 
[settings] 
default = **pro_spider**.settings 
[deploy] 
#url = http://localhost:8800/ 
project = **pro_spider** 

其中的
pro_spider
是你的项目的名字 放在项目代码的外面,注意是项目代码的外面。

猜你喜欢

转载自www.cnblogs.com/amwuau/p/10237558.html