推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
linji
V2EX  ›  Python

我装了一个 Python 3.2,在运行gsutil时出错:SyntaxError: invalid syntax,请问怎么解决呢?

  •  
  •   linji · Mar 8, 2011 · 8803 views
    This topic created in 5719 days ago, the information mentioned may be changed or developed.
    7 replies  •  1970-01-01 08:00:00 +08:00
    linji
    linji
    OP
    Mar 8, 2011
    1
    root:~# gsutil ls
    File "/root/gsutil/gsutil", line 443
    print 'config: %s' % str(config_items)
    ^
    SyntaxError: invalid syntax
    Livid
    Livid
    MOD
    PRO
    Mar 8, 2011
    2
    出错的时候通常都会给出错误所在的行号,去看看那行代码就知道为什么了。
    vayn
    vayn
    Mar 8, 2011
    3
    Python3 的语法和 Python2 有点区别,你试试 print('config: %s' % str(config_items))
    linji
    linji
    OP
    Mar 8, 2011
    4
    请问如何删除 3.2,我想装回 2.7版
    linji
    linji
    OP
    Mar 8, 2011
    5
    @vayn 修改之后,不再有前面的错误,但又出现如下错误,看来是语法的问题,我想装回2.7,要怎样操作呢?

    File "./gsutil", line 445
    except AttributeError, e:
    ^
    SyntaxError: invalid syntax
    ayanamist
    ayanamist
    Mar 8, 2011
    6
    估计LZ不懂Python……Python3和2是两个分支,语法不一样
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2214 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 16:07 · PVG 00:07 · LAX 08:07 · JFK 11:07
    ♥ Do have faith in what you're doing.