简体   繁体   中英

Python command-line breakdown (for “scrapy”)

I was trying to install SCRAPY and play with it.

The tutorial says to run this:

   scrapy startproject tutorial

Can you please break this down to help me understand it. I have various releases of Python on my Windows 7 machine for various conflicting projects, so when I installed Scrapy with their.exe, it installed it in c:\Python26_32bit directory, which is okay. But I don't have any one version of Python in my path.

So I tried:

\python26_32bit\python.exe scrapy startproject tutorial 

and I get the error:

\python26_32bit\python.exe: can't open file 'scrapy': [Errno 2] No such file or directory. 

I do see scrapy installed here: c:\Python26_32bit\Lib\site-packages\scrapy

I cannot find any file called scrapy.py, so what exactly is "scrapy" in Python terminology, a lib, a site-package, a program, ?? and how do I change the sample above to run?

I'm a little more used to Python in Google App Engine environment, so running on my local machine is often more challenging and foreign to me.

scrapy is a batch file which execute a python file called "scrapy", so you need to add the file "scrapy"'s path to your PATH environment.

if that is still not work, make "scrapy.py" file with content

from scrapy.cmdline import execute
execute()

and run \python26_32bit\python.exe scrapy.py startproject tutorial

Try

C:\Python26_32bit\Scripts\Scrapy startproject tutorial 

or add C:\Python26_32bit\Scripts to your path

I ran accross this error with the following setup: Python installed on Windows. Cygwin (babun) installed. Used pip install Scrapy from the Windows installation (Scrapy now in C:\Python27\Lib\site-packages\scrapy). Wanted to use Scrapy from within babun. Got the same error as you. What you can do:

In your.bashrc/.zshrc/etc, add the following:

alias scrapy='python.exe -mscrapy.cmdline'

I can now run scrapy inside babun without any problems.

Note: I also had to run pip install service_identity manually.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM