1. 程式人生 > >Unknown command: crawl

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
是你的專案的名字 放在專案程式碼的外面,注意是專案程式碼的外面。