February 28, 2007

Python on Zaurus Updated

在python內建的shell中沒有command history的功能的話,操作起來還真不方便,每次都要重新輸入一次太麻煩也太浪費時間,所以要讓Zaurus上的python也能像PC上的python一樣有command history的便利功能。

經由comp.lang.python中熱心同好的指點得知,python在沒有readline這個函式庫的環境下編譯,就無法使用command history的功能。Zaurus的toolchain中並沒這個函式庫,所以我必須自行加入。

先在Zaurus的toolchain中加入所需的函式庫, 包含libreadline以及libncursesw。


# cd /opt/Embedix/tools/arm-linux/lib
# tar xzvf libs_readline.tgz
libreadline.so
libreadline.so.5
libreadline.so.5.2
libncursesw.so
libncursesw.so.5
libncursesw.so.5.5

重新編譯python。
詳細步驟請參考這裡

將重新編譯完成的python 及readline的函式庫下載到Zaurus上。


# su
# cd /hdd2/usr
# tar xzvf /home/zaurus/Documents/python25_zaurus.tgz
# cd /hdd2/usr/lib
# tar xzvf libs_readline.tgz

執行Zaurus上的python,現在能用上下鍵取得command history了!!
 
 
==========Python Interactive Interpreter adds command history function==========
I couldn't use command history when I running python interactive interpreter on Zaurus, I need it.
The Zaurus toolchain has no readline and ncursesw libraries, so python on Zaurus has no python2.5/lib-dynload/readline.so library for command history.

1. To add readline and ncursesw libraries into Zaurus toolchain.


# cd /opt/Embedix/tools/arm-linux/lib
# tar xzvf libs_readline.tgz

2.. recompiling python for Zaurus again.
How to compile python? see here.

3. To download python and libraries(readline and ncursesw) to Zaurus.


# su
# cd /hdd2/usr
# tar xzvf /home/zaurus/Documents/python25_zaurus.tgz
# cd /hdd2/usr/lib
# tar xzvf libs_readline.tgz

OK, Python interactive interpreter supports command history now.

Thanks for helps from comp.lang.python

Posted by ThomasC at February 28, 2007 11:34 PM |[ Python , Zaurus ]
Comments

请教楼主,我下载了你的两个压缩包,解压后运行PYTHON,发现还是没法用上下键,按上下键或左右键都是乱码,这是什么原因呢?谢谢

Posted by: binheart on April 28, 2008 10:15 PM

如果你解壓後放的路徑沒放錯,但仍無法使用的話
建議你照步驟自己重新編譯一份。

Posted by: ThomasC on April 30, 2008 01:17 AM
Post a comment