【问题标题】:Navigating in the python terminal在 python 终端中导航
【发布时间】:2023-03-26 05:31:01
【问题描述】:

我想在我的 Mac 上安装一个 64 位的 Python 解释器,所以我必须从源代码重新构建。但是,使用我自己的自定义构建解释器时,当我在 shell 中运行解释器时尝试导航时会遇到问题。在 bash shell 中输入 python 会产生熟悉的结果:

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 的默认解释器中不会发生。

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

【问题讨论】:

    标签: python shell navigation


    【解决方案1】:

    听起来您的自定义构建不包括 readline。应该是简单的配置更改和重建,请查看here 了解更多信息。

    【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2021-01-09
      • 2019-10-03
      • 1970-01-01
      • 2018-06-13
      • 1970-01-01
      • 2023-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多