0

我正在尝试在 RedHat 上安装 simplejson2.4 但是得到:

SyntaxError: Invalid syntax encoder.py line 390

输出:

[~/tmp/simplejson-2.4.0]# python setup.py install
running install
running build
running build_py
running build_ext
running install_lib
byte-compiling /lib64/python2.4/site-packages/simplejson/encoder.py to encoder.pyc
  File "/lib64/python2.4/site-packages/simplejson/encoder.py", line 390
    if (not _bigint_as_string or
     ^
SyntaxError: invalid syntax

代码

...
388         elif isinstance(value, (int, long)):
389                         yield ((buf + str(value))
390                                if (not _bigint_as_string or
391                                    (-1 << 53) < value < (1 << 53))
392                                    else (buf + '"' + str(value) + '"'
...

请指教

4

2 回答 2

2

simplejson 需要 python 2.5。升级你的python(推荐),使用旧版本的simplejson或尝试ultrajson,它支持python 2.4。

于 2012-03-14T17:47:58.480 回答
0

检查以下路径中是否有 simplejson:
/usr/lib64/python2.4/site-packages/

于 2015-06-25T05:01:37.823 回答