[英]Scrapy does not have command 'crawl'
I started to learn Scrapy but right away I get an error Unknown command: crawl
.我开始学习 Scrapy 但马上我得到一个错误
Unknown command: crawl
。 I do not know why im getting this, but in py Scrapy commands I do not have that command.我不知道为什么我得到这个,但是在 py Scrapy 命令中我没有那个命令。 Im using
python 3.6
and pycharm
as editor.我使用
python 3.6
和pycharm
作为编辑器。
(venv) C:\Users\Pc\PycharmProjects\web skreper\venv\Scripts>scrapy crawl quotes
Scrapy 1.7.3 - no active project
Unknown command: crawl
Use "scrapy" to see available commands
(venv) C:\Users\Pc\PycharmProjects\web skreper\venv\Scripts>scrapy
Scrapy 1.7.3 - no active project
Usage:
scrapy <command> [options] [args]
Available commands:
bench Run quick benchmark test
fetch Fetch a URL using the Scrapy downloader
genspider Generate new spider using pre-defined templates
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
This is the basic code that I wrote:这是我写的基本代码:
import scrapy
class My_Scraper(scrapy.Spider):
name = 'quotes'
#url sajtova koje scrapujem
start_urls = [
'https://www.nekretnine.rs/'
]
def parse(self, response):
title = response.css('title').extract()
yield {'title text': title}
You need to be inside the project folder within the Scrapy folder.您需要位于 Scrapy 文件夹内的项目文件夹内。
You are currently trying to run the command from C:\Users\Pc\PycharmProjects\web skreper\venv\Scripts您当前正在尝试从 C:\Users\Pc\PycharmProjects\web skreper\venv\Scripts 运行命令
but it should be something like C:\Users\Pc\PycharmProjects\web skreper\venv\Scripts\Scrapy\My_Scraper但它应该类似于 C:\Users\Pc\PycharmProjects\web skreper\venv\Scripts\Scrapy\My_Scraper
You must get out from the script folder and move to the project directory where scrapy.cfg
file placed.您必须从脚本文件夹中退出并移动到放置
scrapy.cfg
文件的项目目录。
Run the scrapy crawl from there it will work.从那里运行 scrapy 爬网它将起作用。
I know this is an old post but I would also like to contribute an additional instance that may result in the missing of crawl command我知道这是一篇旧帖子,但我还想提供一个可能导致缺少 crawl 命令的额外实例
if you accidentally delete the cfg file, crawl command will disappear too.如果您不小心删除了 cfg 文件,那么 crawl 命令也会消失。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.