您必须在“startproject”文件夹中执行它。如果它找到您的 scrapy.cfg 文件,您将有另一个命令。你可以在这里看到区别:
$ scrapy startproject bar
$ cd bar/
$ ls
bar scrapy.cfg
$ scrapy
Scrapy 0.12.0.2536 - project: bar
Usage:
scrapy <command> [options] [args]
Available commands:
crawl Start crawling from a spider or URL
deploy Deploy project in Scrapyd target
fetch Fetch a URL using the Scrapy downloader
genspider Generate new spider using pre-defined templates
list List available spiders
parse Parse URL (using its spider) and print the results
queue Deprecated command. See Scrapyd documentation.
runserver Deprecated command. Use 'server' command instead
runspider Run a self-contained spider (without creating a project)
server Start Scrapyd server for this project
settings Get settings values
shell Interactive scraping console
startproject Create new project
version Print Scrapy version
view Open URL in browser, as seen by Scrapy
Use "scrapy <command> -h" to see more info about a command
$ cd ..
$ scrapy
Scrapy 0.12.0.2536 - no active project
Usage:
scrapy <command> [options] [args]
Available commands:
fetch Fetch a URL using the Scrapy downloader
runspider Run a self-contained spider (without creating a project)
settings Get settings values
shell Interactive scraping console
startproject Create new project
version Print Scrapy version
view Open URL in browser, as seen by Scrapy
Use "scrapy <command> -h" to see more info about a command