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
是你的項目的名字 放在項目代碼的外面,注意是項目代碼的外面。