2012-03-14 71 views
0

我試圖安裝在RedHat simplejson2.4然而越來越:語法錯誤:無效的語法,而安裝simplejson 2.4線390 - 蟒蛇2.4.3

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) + '"' 
... 

請指教

回答

2

simplejson需要python 2.5。無論是升級你的python(推薦),使用舊版本的simplejson或嘗試超現實,其中,afair,支持python 2.4。

+0

我嘗試安裝2.3.3和仍然相同的問題。你知道哪個simplejson版本支持python2.4嗎?我檢查了文檔,並提到它向後兼容2.4 – m1k3y3 2012-03-14 17:50:58

+0

@ m1k3y02我會升級你的Python版本。 – CoffeeRain 2012-03-14 17:55:08

+0

gcbirzan - 我再次查看文檔。你是對的,因爲simplejson版本2.1不支持python 2.4 @CoffeRain - 我在這個過程中:)謝謝 – m1k3y3 2012-03-14 21:02:18

0

檢查是否有以下路徑simplejson:
/usr/lib64/python2.4/site-packages/