`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条回答
Bombasti
2楼-- · 2020-01-27 01:18

The classic 'have you tried turning it off and on again' worked for me.

pip uninstall ipython
pip install ipython
查看更多
老娘就宠你
3楼-- · 2020-01-27 01:19

pip told me I had pyreadline version 1.7.1 installed

C:\Users\me>pip freeze | grep readline
pyreadline==1.7.1

Upgrading pyreadline fixed it for me:

C:\Users\me>pip install --upgrade pyreadline

C:\Users\me>pip freeze | grep readline
pyreadline==2.0
查看更多
老娘就宠你
4楼-- · 2020-01-27 01:23

Your ipythonrc file may be out of date. Try running

ipython -upgrade
查看更多
我想做一个坏孩纸
5楼-- · 2020-01-27 01:24

Be sure you have installed the pyreadline library. It is needed for tab completion and other IPython functions - in Windows it doesn't come with the IPython package and you have to install it separately -

> pip install pyreadline
查看更多
【Aperson】
6楼-- · 2020-01-27 01:24

I realize this is a really old question, but none of the answers above worked for me (And this is the first hit you get when you google a question of this nature).

I should mention that this is NOT exclusive to windows, I had the problem running CentOS 6.5 and Python 2.7

Here is what I did:

apt-get/yum install ncurses-devel
#If you want history in iPython:
apt-get/yum install sqlite-devel
easy_install ipython readline
ipython

In [1]: from 
Display all 391 possibilities? (y or n)

If you don't have the -devel packages, your install will fail when it comes time to link them and build the eggs.. Hope this helps others!

查看更多
Evening l夕情丶
7楼-- · 2020-01-27 01:27

Someone else in StackOverflow posted this link: http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/

Its basicly easy_install readline than discover where the readline egg got installed and edit the ipython bin script to use this readline:

  1. Install the "official" readline: easy_install readline
  2. Discover where it is. Look at /Library/Python/site-packages/readline-*.egg or in your Virtualenv counterpart
  3. Discover where ipython bin is: which ipython
  4. Add ONE LINE to this file, adding the readline egg path right after import sys line.

My virtualenved ipython bin script got working as follow:

#!/Users/alanjds/src/git/cervejeiras/venv/cervejeiras-lfs/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'ipython==0.13.1','console_scripts','ipython'
__requires__ = 'ipython==0.13.1'
import sys

### ONLY LINE ADDED:
sys.path.insert(0, '/Users/alanjds/src/git/cervejeiras/venv/cervejeiras-lfs/lib/python2.6/site-packages/readline-6.2.4.1-py2.6-macosx-10.6-fat.egg')
####

from pkg_resources import load_entry_point

if __name__ == '__main__':
    sys.exit(
        load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython')()
    )
查看更多
登录 后发表回答