MacのPython3.0で履歴が辿れないとか,readlineとか

LeopardでPython3.0を使うために,

sudo port install python3.0

pythonをインストールしてもインタラクティブシェルで↑(上)キーを押しても履歴を辿れなかった.

~/srm $ python3.0
Python 3.0rc1 (r30rc1:66499, Dec 14 2008, 04:33:44)
[GCC 4.0.1 (Apple Inc. build 5490)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named readline

readlineライブラリが使えていないのが原因ぽいので,探す

~/srm $ sudo port search readline python
gauche-readline devel/gauche-readline 0.1 gauche-readline adds input line editing feature to Gauche
readline devel/readline 5.2.012 Library that provides command line editing
readline-4 devel/readline-4 4.3 Library that provides command line editing
readline-5 devel/readline-5 5.0.005 Library that provides command line editing
p5-term-readline-gnu perl/p5-term-readline-gnu 1.16 Perl extension for the GNU Readline/History library
py-readline python/py-readline 2.4.5 readline extension for Python
py25-readline python/py25-readline 2.5.2 readline extension for Python
py30-readline python/py30-readline 3.0b3 readline extension for Python
(...)
python_select sysutils/python_select 0.1 Switch the default python interpreter
mod_python www/mod_python 3.3.1 Apache2 module that embeds Python within the server.
mod_python25 www/mod_python25 3.3.1 Apache2 module that embeds Python within the server.

それぽいのがあったので,

~/srm $ sudo port install py30-readline

これでいけたぽい.


上キーを押して履歴が辿れることを確認できた.

はちろくチャットのnishioさん,yanbeさんとharajuneに感謝.