不明确的制表符补全在 Windows 上的 iPython 中不起作用

发布于 2024-09-24 23:33:06 字数 857 浏览 0 评论 0原文

我在安装了 pyreadline 的 Windows 7 x64 上运行 IPython。如果我开始一个新会话并输入:

import numpy
nu<TAB>

然后 nu 自动完成为 numpy。但是,如果我开始一个新会话并尝试以下操作:

import numpy
n<TAB>

那么什么也不会发生。我希望它能够循环所有可能的完成。我目前正在使用开箱即用的配置,我是否需要更改设置以启用不明确的选项卡完成功能,或者我只是运气不好?

编辑: 为了解决 ma3204 的评论,这里有另一个例子(从新的 ipython 会话开始):

[In 1]: value1 = 5

[In 2]: value2 = 6

[In 3]: va<TAB>       ... nothing happens
[In 3]: va<Ctrl + l>
vars   value2 value1

[In 3]: val<TAB>      ... completes to 'value'
[In 3]: value
[In 3]: value<Ctrl + l>
value2 value1

[In 3]: value

当我在上面输入 va 时,我希望每次按 Tab 键都会循环浏览 value1value2varsvalue1value2 等。

I am running IPython on Windows 7 x64 with pyreadline installed. If I start a new session and type:

import numpy
nu<TAB>

Then nu autocompletes to numpy. However, if I start a new session and try this:

import numpy
n<TAB>

Then nothing happens. I would expect it to cycle through all of the possible completions. I'm currently using out of the box config, do I need to change a setting to enable ambiguous tab completion or am I just out of luck?

EDIT:
To address the comment from ma3204, here is another example (start with fresh ipython session):

[In 1]: value1 = 5

[In 2]: value2 = 6

[In 3]: va<TAB>       ... nothing happens
[In 3]: va<Ctrl + l>
vars   value2 value1

[In 3]: val<TAB>      ... completes to 'value'
[In 3]: value
[In 3]: value<Ctrl + l>
value2 value1

[In 3]: value

When I type va<TAB> above I would expect each tab press to cycle through value1, value2, vars, value1, value2, etc.

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

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

发布评论

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

评论(2

暮年慕年 2024-10-01 23:33:06

您必须将 pyreadline 的配置文件复制到您的 HOME 文件夹(C:\Users\<用户名>)。

打开命令行并执行:

copy "C:\Program Files (x86)\Python26\Lib\site-packages\pyreadline\configuration\pyreadlineconfig.ini" %HOMEPATH%

You have to copy config file for pyreadline to your HOME folder (C:\Users\< username >).

Open Command line and execute that:

copy "C:\Program Files (x86)\Python26\Lib\site-packages\pyreadline\configuration\pyreadlineconfig.ini" %HOMEPATH%
驱逐舰岛风号 2024-10-01 23:33:06

刚刚安装了python 2.6和numpy、ipython等。我也对此感到恼火。在我的其他安装较旧的计算机上它可以工作。我经常使用完成列表来查看哪些命令可用,因此当它不起作用时我会感到沮丧。

编辑:发现你可以用 CTRL-l 来获取它。查看 ipythonrc ,它应该像我习惯的那样工作,但不是。但 CTRL-l 可以工作。将看看它是否会重新启动。好像记得我以前也遇到过类似的问题,但过了一段时间就解决了。

Just installed python 2.6 and numpy, ipython and so on. I am also annoyed of this. On my other computers with older installations it works. I use the completions list very much to see what commands are available so I feel frustrated when it doesn't work.

EDIT: Found that you can get it with CTRL-l. Looked in ipythonrc and it should work like I am used to but not. The CTRL-l work though. Will see if it kicks back on. Seem to remember that I had similar trouble before but it worked after some time.

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