llhh
V2EX  ›  问与答

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

  •  
  •   llhh · Nov 2, 2014 · 7063 views
    This topic created in 4234 days ago, the information mentioned may be changed or developed.
    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 replies    2014-11-02 17:03:24 +08:00
    messense
        1
    messense  
       Nov 2, 2014   ❤️ 1
    是直接在终端输入命令就好,这里的终端指的是终端,不是终端里的运行 python 之后的终端啊。
    llhh
        2
    llhh  
    OP
       Nov 2, 2014
    C:\Users\bo>scrapy startproject cnbeta
    ‘scrapy’不是内部或外部命令,也不是课可运行的程序或批处理文件。

    这样提示呢?
    messense
        3
    messense  
       Nov 2, 2014   ❤️ 1
    Windows 的 Path 设置问题吧
    llhh
        4
    llhh  
    OP
       Nov 2, 2014
    @messense 可是python是可以执行的,而scrapy不用单独设置path吧?
    messense
        5
    messense  
       Nov 2, 2014
    messense
        6
    messense  
       Nov 2, 2014
    @llhh scapy 应该是安装在 site-packages 里面的,然后导出了一个可执行文件在某个地方(Linux 下经常是 /usr/local/bin/scapy,Windows 下经常是 C:\PythonPath\Scripts 里面),所以得设置下 Path 才能找到。
    llhh
        7
    llhh  
    OP
       Nov 2, 2014
    @messense 感谢
    我的path设置如下
    path = c:\python27;path = C:\Python27\Scripts
    llhh
        8
    llhh  
    OP
       Nov 2, 2014
    @messense 感谢了,是环境变量的问题,已经ok了。运营狗真不容易,终于可以写爬虫了,囧~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   905 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 19:55 · PVG 03:55 · LAX 12:55 · JFK 15:55
    ♥ Do have faith in what you're doing.