V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
llhh
V2EX  ›  问与答

scrapy startproject 不是直接在终端输入命令就好吗?

  •  
  •   llhh · 2014-11-02 16:34:35 +08:00 · 6586 次点击
    这是一个创建于 3484 天前的主题,其中的信息可能已经有所发展或是发生改变。
    C:\Users\bo>python
    Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win
    32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import scrapy
    >>> scrapy startproject cnbeta
    File "<stdin>", line 1
    scrapy startproject cnbeta
    ^
    SyntaxError: invalid syntax
    >>>

    试了几次,为什么总是错误呢。

    谢谢大家。
    8 条回复    2014-11-02 17:03:24 +08:00
    messense
        1
    messense  
       2014-11-02 16:38:39 +08:00   ❤️ 1
    是直接在终端输入命令就好,这里的终端指的是终端,不是终端里的运行 python 之后的终端啊。
    llhh
        2
    llhh  
    OP
       2014-11-02 16:41:52 +08:00
    C:\Users\bo>scrapy startproject cnbeta
    ‘scrapy’不是内部或外部命令,也不是课可运行的程序或批处理文件。

    这样提示呢?
    messense
        3
    messense  
       2014-11-02 16:44:04 +08:00   ❤️ 1
    Windows 的 Path 设置问题吧
    llhh
        4
    llhh  
    OP
       2014-11-02 16:45:51 +08:00
    @messense 可是python是可以执行的,而scrapy不用单独设置path吧?
    messense
        5
    messense  
       2014-11-02 16:46:27 +08:00
    messense
        6
    messense  
       2014-11-02 16:48:18 +08:00
    @llhh scapy 应该是安装在 site-packages 里面的,然后导出了一个可执行文件在某个地方(Linux 下经常是 /usr/local/bin/scapy,Windows 下经常是 C:\PythonPath\Scripts 里面),所以得设置下 Path 才能找到。
    llhh
        7
    llhh  
    OP
       2014-11-02 16:53:49 +08:00
    @messense 感谢
    我的path设置如下
    path = c:\python27;path = C:\Python27\Scripts
    llhh
        8
    llhh  
    OP
       2014-11-02 17:03:24 +08:00
    @messense 感谢了,是环境变量的问题,已经ok了。运营狗真不容易,终于可以写爬虫了,囧~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2210 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 01:05 · PVG 09:05 · LAX 18:05 · JFK 21:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.