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.
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
Your ipythonrc file may be out of date. Try running
ipython -upgrade
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
The classic 'have you tried turning it off and on again' worked for me.
pip uninstall ipython
pip install ipython
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.
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:
- Install the "official" readline:
easy_install readline
- Discover where it is. Look at
/Library/Python/site-packages/readline-*.egg
or in your Virtualenv counterpart - Discover where ipython bin is:
which ipython
- 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')()
)
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!
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
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.
I had to mv ~/.ipython{,.bak}
in my case.
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
Downgrading iPython did the trick.
pip install --upgrade ipython==5.8.0
来源:https://stackoverflow.com/questions/2603798/ipython-tab-autocomplete-does-not-work-on-imported-module