添加 Readline 功能而无需重新编译 Python

发布于 2024-09-24 05:57:45 字数 258 浏览 1 评论 0原文

我最近升级到 Ubuntu 10.04 LTS 并刷新了我的 Python 环境。我从源代码安装了Python 2.7。不幸的是,我没有注意到Setup.dist默认情况下注释掉了readline行——默认情况下,没有安装readline支持。我现在使用 Python 解释器作为 REPL,以至于常量 ^[[A 和 ^[[D 非常令人讨厌。

我可以快速添加 readline 支持,还是必须再次重新编译 Python?似乎应该有一种快速、理智的方法来做到这一点,但我不知道这样的方法。

I recently upgraded to Ubuntu 10.04 LTS and refreshed my Python environment. I installed Python 2.7 from source. Unfortunately, I didn't notice that Setup.dist has the readline line commented out by default - by default, there is no readline support installed. I'm now using the Python interpreter as a REPL enough that the constant ^[[A and ^[[D are very obnoxious.

Can I add readline support quickly, or do I have to actually recompile Python again? It seems like the sort of thing where there should be a quick, sane way to do it, but I don't know such a way.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

女中豪杰 2024-10-01 05:57:45

有一个独立的 gnureadline 包可用,您可以使用 setuptools 安装它

$ easy_install readline

您也可以考虑使用 ipython 代替。

There's a standalone gnureadline package available, you can install it using setuptools

$ easy_install readline

You might also consider using ipython instead.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文