Scrapy startproject不使用git-bash

时间:2016-05-18 19:59:30

标签: python windows scrapy anaconda git-bash

我在使用git-bash的系统上使用win7。我已经安装了Miniconda并使用以下方法加载了scrapy:

conda install -c scrapinghub scrapy

我已将环境变量设置为包含:

C:\Miniconda2;C:\Miniconda2\Scripts

现在在scrapy vitualenv中,当我这样做时:

(scrapy)
$ scrapy startproject scrapytest    
sh: scrapy: command not found

如何在此处使用scrapy命令行工具?

2 个答案:

答案 0 :(得分:2)

我不知道git-bash对此有何影响,但安装scrapy registers one entry point, a console script,调用scrapy.cmdline:execute。有关入口点的更多信息,请参阅this page

您可以使用带有-m的python解释器来调用它,如下所示:

python -m scrapy.cmdline startproject scrapytest

答案 1 :(得分:0)

使用上面的anaconda安装命令似乎有问题。我使用python 2.7.11创建了一个新的virtualenv并使用pip安装了scrapy并且它工作正常。之前的部分问题可能是pip没有更新到最新版本,所以首先要这样做。这是我在虚拟环境中安装的软件包列表:

$ pip list
attrs (15.2.0)
backports-abc (0.4)
backports.shutil-get-terminal-size (1.0.0)
backports.ssl-match-hostname (3.5.0.1)
certifi (2016.2.28)
cffi (1.6.0)
configparser (3.5.0)
cryptography (1.3.2)
cssselect (0.9.1)
decorator (4.0.9)
entrypoints (0.2.2)
enum34 (1.1.6)
functools32 (3.2.3.post2)
idna (2.1)
ipaddress (1.0.16)
ipykernel (4.3.1)
ipython (4.2.0)
ipython-genutils (0.1.0)
ipywidgets (5.1.4)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.2.2)
jupyter-console (4.1.1)
jupyter-core (4.1.0)
lxml (3.6.0)
MarkupSafe (0.23)
mistune (0.7.2)
nbconvert (4.2.0)
nbformat (4.0.1)
notebook (4.2.0)
parsel (1.0.2)
pathlib2 (2.1.0)
pickleshare (0.7.2)
pip (8.1.2)
psycopg2 (2.6.1)
ptyprocess (0.5.1)
pyasn1 (0.1.9)
pyasn1-modules (0.0.8)
pycparser (2.14)
PyDispatcher (2.0.5)
Pygments (2.1.3)
pyOpenSSL (16.0.0)
pyreadline (2.1)
pywin32 (220)
pyzmq (15.2.0)
qtconsole (4.2.1)
queuelib (1.4.2)
Scrapy (1.1.0)
service-identity (16.0.0)
setuptools (21.1.0)
simplegeneric (0.8.1)
singledispatch (3.4.0.3)
six (1.10.0)
SQLAlchemy (1.0.13)
terminado (0.6)
tornado (4.3)
traitlets (4.2.1)
Twisted (16.2.0)
w3lib (1.14.2)
widgetsnbextension (1.2.2)
zope.interface (4.1.3)