Python 命令行细分(针对“scrapy”)
我试图安装 SCRAPY 并使用它。
教程说运行这个:
scrapy startproject tutorial
你能把它分解一下来帮助我理解它吗?我的 Windows 7 机器上有各种版本的 Python,用于各种冲突的项目,因此当我使用其 .exe 安装 Scrapy 时,它会将其安装在 c:\Python26_32bit 目录中,这没关系。但我的路径中没有任何一种版本的 Python。
所以我尝试了:
\python26_32bit\python.exe scrapy startproject tutorial
并且收到错误:
\python26_32bit\python.exe: can't open file 'scrapy': [Errno 2] No such file or directory.
我确实看到scrapy安装在这里:c:\Python26_32bit\Lib\site-packages\scrapy
我找不到任何名为scrapy.py的文件,那么Python术语中的“scrapy”到底是什么,一个库,一个站点包,一个程序,??以及如何更改上面的示例来运行?
我更习惯 Google App Engine 环境中的 Python,因此在本地计算机上运行对我来说通常更具挑战性和陌生性。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
scrapy是一个批处理文件,它执行一个名为“scrapy”的python文件,因此您需要将文件“scrapy”的路径添加到您的PATH环境中。
如果仍然不起作用,请制作包含内容的“scrapy.py”文件
并运行
\python26_32bit\python.exe scrapy.py startprojecttutorial
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
and run
\python26_32bit\python.exe scrapy.py startproject tutorial
尝试
或
将
C:\Python26_32bit\Scripts
添加到您的路径Try
or
add
C:\Python26_32bit\Scripts
to your path我通过以下设置遇到了此错误:Windows 上安装了 Python。 Cygwin(babun)已安装。使用 Windows 安装中的
pip install Scrapy
(Scrapy 现在位于 C:\Python27\Lib\site-packages\scrapy)。想在 babun 中使用 Scrapy。和你有同样的错误。您可以做什么:在 .bashrc/.zshrc/etc 中,添加以下内容:
alias scrapy='python.exe -mscrapy.cmdline'
我现在可以在 babun 中运行 scrapy,没有任何问题。
注意:我还必须手动运行
pip install service_identity
。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.