在python终端中导航

时间:2009-10-23 22:50:36

标签: python shell navigation

我想在我的Mac上使用64位python解释器,所以我不得不从源代码重建。但是,使用我自己的自定义构建解释器时,当我从shell内部运行解释器时尝试导航时会遇到问题。将python键入bash shell会产生熟悉的结果:

Python 2.6.3 (r263:75183, Oct 23 2009, 14:23:25) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

但是,当我尝试使用左箭头和右箭头导航时,我会得到奇怪的字符:

Python 2.6.3 (r263:75183, Oct 23 2009, 14:23:25) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^[[A^[[A^[[A^[[D^[[C^[[C^[[A^[[B^[[D^[[C

这在Apple的默认解释器中不会发生。

造成这种情况的原因是什么?我该如何解决?

2 个答案:

答案 0 :(得分:6)

听起来您的自定义版本不包含readline。应该是一个简单的配置更改和重建,请查看here以获取更多信息。

答案 1 :(得分:0)

here安装GNU readline库,并重建python解决了这个问题。