与python控制台中的ipython类似的默认选项卡完成

与python控制台中的ipython类似的默认选项卡完成,python,Python,我知道我可以用这个: import rlcompleter, readline readline.parse_and_bind('tab: complete') 在我的python解释器中启用ipython样式选项卡完成 在启动python时,如何使其在默认情况下运行?将其放入文件.pythonrc(您可以通过环境变量PYTHONSTARTUP控制该文件的名称)。阅读更多关于: 另见: 您链接了关于Python 2.7与3.2的问题-这是否意味着您必须在OP的代码中为2与3做一些不同的事

我知道我可以用这个:

import rlcompleter, readline
readline.parse_and_bind('tab: complete')
在我的python解释器中启用ipython样式选项卡完成


在启动python时,如何使其在默认情况下运行?

将其放入文件
.pythonrc
(您可以通过环境变量
PYTHONSTARTUP
控制该文件的名称)。阅读更多关于:

另见:


您链接了关于Python 2.7与3.2的问题-这是否意味着您必须在OP的代码中为2与3做一些不同的事情?啊,可能不是这样
readline
是在OS X上用
libedit
实现的。您必须根据使用
“bind^I rl_complete”
。我似乎没有.pythonrc文件。有没有一个推荐的、标准的地方可以把它放在ubuntu机器上<代码>只需导出PYTHONSTARTUP=$HOME/.pythonrc就像您提到的另一个答案一样?
PYTHONSTARTUP
If this is the name of a readable file, the Python commands 
in that file are executed before the first prompt is displayed
in interactive mode. The file is executed in the same namespace
where interactive commands are executed so that objects defined
or imported in it can be used without qualification in the interactive
session. You can also change the prompts sys.ps1 and sys.ps2 in this file.