Ambiguous tab completion not working in iPython on

2019-03-10 09:01发布

问题:

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.

回答1:

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%


回答2:

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.