简体   繁体   English

在不重编译Python的情况下添加Readline功能

[英]Adding Readline Functionality Without Recompiling Python

I recently upgraded to Ubuntu 10.04 LTS and refreshed my Python environment. 我最近升级到Ubuntu 10.04 LTS并刷新了我的Python环境。 I installed Python 2.7 from source. 我从源代码安装了Python 2.7。 Unfortunately, I didn't notice that Setup.dist has the readline line commented out by default - by default, there is no readline support installed. 不幸的是,我没有注意到Setup.dist默认注释掉了readline行 - 默认情况下,没有安装readline支持。 I'm now using the Python interpreter as a REPL enough that the constant ^[[A and ^[[D are very obnoxious. 我现在正在使用Python解释器作为REPL足够的常量^ [[A和^ [[D非常令人讨厌。

Can I add readline support quickly, or do I have to actually recompile Python again? 我可以快速添加readline支持,还是必须重新编译Python? 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. 似乎应该有一种快速,理智的方式来做这件事,但我不知道这样的方式。

There's a standalone gnureadline package available, you can install it using setuptools 有一个独立的gnureadline包 ,你可以使用setuptools安装它

$ easy_install readline

You might also consider using ipython instead. 您也可以考虑使用ipython

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM