V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2011-03-08 22:49:01 +08:00 · 7237 次点击
    这是一个创建于 4790 天前的主题,其中的信息可能已经有所发展或是发生改变。
    7 条回复    1970-01-01 08:00:00 +08:00
    linji
        1
    linji  
    OP
       2011-03-08 22:54:50 +08:00
    root:~# gsutil ls
    File "/root/gsutil/gsutil", line 443
    print 'config: %s' % str(config_items)
    ^
    SyntaxError: invalid syntax
    Livid
        2
    Livid  
    MOD
       2011-03-08 22:55:13 +08:00
    出错的时候通常都会给出错误所在的行号,去看看那行代码就知道为什么了。
    vayn
        3
    vayn  
       2011-03-08 23:01:35 +08:00
    Python3 的语法和 Python2 有点区别,你试试 print('config: %s' % str(config_items))
    linji
        4
    linji  
    OP
       2011-03-08 23:14:18 +08:00
    请问如何删除 3.2,我想装回 2.7版
    linji
        5
    linji  
    OP
       2011-03-08 23:18:30 +08:00
    @vayn 修改之后,不再有前面的错误,但又出现如下错误,看来是语法的问题,我想装回2.7,要怎样操作呢?

    File "./gsutil", line 445
    except AttributeError, e:
    ^
    SyntaxError: invalid syntax
    ayanamist
        6
    ayanamist  
       2011-03-08 23:36:54 +08:00
    估计LZ不懂Python……Python3和2是两个分支,语法不一样
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1945 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:18 · PVG 00:18 · LAX 09:18 · JFK 12:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.