`ipython` tab autocomplete does not work on import

2020-01-27 00:38发布

Tab completion on IPython seems not to be working. For example,

import numpy
numpy.<tab>

simply adds a tab.

import numpy
num<tab>

just adds a tab, too. Could you please suggest some possible causes for this problem? I am running Windows 7 and Python 2.6.5.

12条回答
女痞
2楼-- · 2020-01-27 01:29

Pyreadline is needed by ipython. Install pyreadline. This was done in Windows 7. Get pyreadline zip, pyreadline-master.zip, unzip. In powershell change directory into uzipped pyreadline, make sure python is set in Path, and enter commandpython setup.py install This will intall pyreadline in C:\Python27\Lib\site-packages

查看更多
Emotional °昔
3楼-- · 2020-01-27 01:30

If you use Jupyter notebook and you still did get Tab auto-complete working after you tried all the steps suggested in the post here, you might want to check if you are trying to use the Tab auto-completion within a function definition. Ifyour import statements are part of the function such as below, you will not get the Tab auto-completion. You need to put the import statements outside the function and also execute them once before asking for auto-completion on the packages.

def myfunction():
    import pandas as pd
    import numpy as np

    a = pd.DataFrame(np.random.normal(1,3, (4,4))
    return a
查看更多
成全新的幸福
4楼-- · 2020-01-27 01:32

As of right now, on a OSX, pip installed ipython doesn't give tab completion, pyreadline release.py is busted .. what WFM:

easy_install ipython readline

YMMV.

查看更多
三岁会撩人
5楼-- · 2020-01-27 01:32

I had this problem and knew that I had the pip installed for the module I was looking for. Performing $ ipython --init solved the problem for me.

查看更多
倾城 Initia
6楼-- · 2020-01-27 01:39

I had to mv ~/.ipython{,.bak} in my case.

查看更多
男人必须洒脱
7楼-- · 2020-01-27 01:45

Downgrading iPython did the trick.

pip install --upgrade ipython==5.8.0
查看更多
登录 后发表回答