Scrapy error is not recognized

1

I am trying to run a spider according to the " scrapy " library and when executing the command.

scrapy runspider my_spider.py -o data.csv -t csv --set CLOSESPIDER_ITEMCOUNT=10

It signals me the following error

  

scrapy is not recognized as an internal or external command, program or   batch file executable.

    
asked by Andres Felipe Estrada Rodrigue 14.12.2017 в 15:35
source

1 answer

0

In addition to having Scrapy installed via pip you must have the Scripts directory of your Python installation in the PATH, where by default the executable should be found:

First check the path where you have Python installed , if you have several versions of the interpreter you should look for the one where you have Scrapy installed, for example for the default installation directory in Python W10 3.6 as seen in the previous image it would be:

  

C: \ Users \ YourUser \ AppData \ Local \ Programs \ Python \ Python36

Then add the path to /Scripts to Path, for the previous example it would be:

  

C: \ Users \ YourUser \ AppData \ Local \ Programs \ Python \ Python36 \ Scripts \

Once the path has been added to the Path, do not forget to restart the terminal or open a new instance of CMD for the change to take effect.

The other option is that you position yourself with the terminal in the /Scripts directory and once it is placed in it, you cast it as you do now, or call the executable by passing its absolute path:

  

$ C: \ Users \ YourUser \ AppData \ Local \ Programs \ Python \ Python36 \ Scripts \ scrapy runspider ...

In this case it does not matter, but multiple commands of scraper (like crawl ) require having a correctly configured project.

    
answered by 14.12.2017 / 16:36
source