Tab completion on IPython seems not to be working. For example,
IPython上的标签完成似乎不起作用。例如,
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.
只是添加一个标签。你能否提出一些可能导致这个问题的原因?我正在运行Windows 7和Python 2.6.5。
11 个解决方案
#1
86
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 -
确保已安装pyreadline库。选项卡完成和其他IPython功能需要它 - 在Windows中它没有附带IPython包,你必须单独安装它 -
> pip install pyreadline
#2
9
Your ipythonrc file may be out of date. Try running
您的ipythonrc文件可能已过期。试试跑步
ipython -upgrade
#3
6
pip
told me I had pyreadline version 1.7.1 installed
pip告诉我,我安装了pyreadline 1.7.1版
C:\Users\me>pip freeze | grep readline
pyreadline==1.7.1
Upgrading pyreadline
fixed it for me:
升级pyreadline为我修复了它:
C:\Users\me>pip install --upgrade pyreadline
C:\Users\me>pip freeze | grep readline
pyreadline==2.0
#4
2
The classic 'have you tried turning it off and on again' worked for me.
经典的“你试过把它关掉再打开”对我有用。
pip uninstall ipython
pip install ipython
#5
1
As of right now, on a OSX, pip installed ipython doesn't give tab completion, pyreadline release.py is busted .. what WFM:
截至目前,在OSX上,pip安装的ipython没有给标签完成,pyreadline release.py被破坏..什么是WFM:
easy_install ipython readline
YMMV.
因人而异。
#6
1
Someone else in * posted this link: http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/
*中的其他人发布了此链接: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:
它基本上是easy_install readline,而不是发现readline egg安装的位置,并编辑ipython bin脚本以使用此readline:
- Install the "official" readline:
easy_install readline
- 安装“官方”readline:easy_install readline
- Discover where it is. Look at
/Library/Python/site-packages/readline-*.egg
or in your Virtualenv counterpart - 发现它的位置。看看/Library/Python/site-packages/readline-*.egg或你的Virtualenv对应物
- Discover where ipython bin is:
which ipython
- 发现ipython bin的位置:ipython
- Add ONE LINE to this file, adding the readline egg path right after
import sys
line. - 在此文件中添加一行,在导入sys行后立即添加readline egg路径。
My virtualenved ipython bin script got working as follow:
我的虚拟ipython bin脚本开始工作如下:
#!/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')()
)
#7
1
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
我应该提到这不是Windows独有的,我遇到运行CentOS 6.5和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!
如果您没有-devel软件包,那么当需要链接它们并构建鸡蛋时,您的安装将会失败。希望这有助于其他人!
#8
0
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
ipython需要Pyreadline。安装pyreadline。这是在Windows 7中完成的。获取pyreadline zip,pyreadline-master.zip,解压缩。在powershell中将目录更改为uzipped pyreadline,确保在Path中设置python,然后输入commandpython setup.py install这将在C:\ Python27 \ Lib \ site-packages中输入pyreadline
#9
0
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.
我有这个问题,知道我已经为我正在寻找的模块安装了点子。执行$ ipython --init为我解决了这个问题。
#10
0
I had to mv ~/.ipython{,.bak}
in my case.
在我的情况下,我不得不使用mv~ / .ipython {,。bak}。
#11
0
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.
如果您使用Jupyter笔记本,并且在尝试了此处帖子中建议的所有步骤后仍然可以使Tab自动完成工作,您可能需要检查是否尝试在函数定义中使用Tab自动完成。如果您的import语句是函数的一部分,如下所示,您将无法获得Tab自动完成。您需要将import语句放在函数外部,并在要求对包进行自动完成之前执行它们一次。
def myfunction():
import pandas as pd
import numpy as np
a = pd.DataFrame(np.random.normal(1,3, (4,4))
return a
#1
86
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 -
确保已安装pyreadline库。选项卡完成和其他IPython功能需要它 - 在Windows中它没有附带IPython包,你必须单独安装它 -
> pip install pyreadline
#2
9
Your ipythonrc file may be out of date. Try running
您的ipythonrc文件可能已过期。试试跑步
ipython -upgrade
#3
6
pip
told me I had pyreadline version 1.7.1 installed
pip告诉我,我安装了pyreadline 1.7.1版
C:\Users\me>pip freeze | grep readline
pyreadline==1.7.1
Upgrading pyreadline
fixed it for me:
升级pyreadline为我修复了它:
C:\Users\me>pip install --upgrade pyreadline
C:\Users\me>pip freeze | grep readline
pyreadline==2.0
#4
2
The classic 'have you tried turning it off and on again' worked for me.
经典的“你试过把它关掉再打开”对我有用。
pip uninstall ipython
pip install ipython
#5
1
As of right now, on a OSX, pip installed ipython doesn't give tab completion, pyreadline release.py is busted .. what WFM:
截至目前,在OSX上,pip安装的ipython没有给标签完成,pyreadline release.py被破坏..什么是WFM:
easy_install ipython readline
YMMV.
因人而异。
#6
1
Someone else in * posted this link: http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/
*中的其他人发布了此链接: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:
它基本上是easy_install readline,而不是发现readline egg安装的位置,并编辑ipython bin脚本以使用此readline:
- Install the "official" readline:
easy_install readline
- 安装“官方”readline:easy_install readline
- Discover where it is. Look at
/Library/Python/site-packages/readline-*.egg
or in your Virtualenv counterpart - 发现它的位置。看看/Library/Python/site-packages/readline-*.egg或你的Virtualenv对应物
- Discover where ipython bin is:
which ipython
- 发现ipython bin的位置:ipython
- Add ONE LINE to this file, adding the readline egg path right after
import sys
line. - 在此文件中添加一行,在导入sys行后立即添加readline egg路径。
My virtualenved ipython bin script got working as follow:
我的虚拟ipython bin脚本开始工作如下:
#!/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')()
)
#7
1
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
我应该提到这不是Windows独有的,我遇到运行CentOS 6.5和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!
如果您没有-devel软件包,那么当需要链接它们并构建鸡蛋时,您的安装将会失败。希望这有助于其他人!
#8
0
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
ipython需要Pyreadline。安装pyreadline。这是在Windows 7中完成的。获取pyreadline zip,pyreadline-master.zip,解压缩。在powershell中将目录更改为uzipped pyreadline,确保在Path中设置python,然后输入commandpython setup.py install这将在C:\ Python27 \ Lib \ site-packages中输入pyreadline
#9
0
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.
我有这个问题,知道我已经为我正在寻找的模块安装了点子。执行$ ipython --init为我解决了这个问题。
#10
0
I had to mv ~/.ipython{,.bak}
in my case.
在我的情况下,我不得不使用mv~ / .ipython {,。bak}。
#11
0
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.
如果您使用Jupyter笔记本,并且在尝试了此处帖子中建议的所有步骤后仍然可以使Tab自动完成工作,您可能需要检查是否尝试在函数定义中使用Tab自动完成。如果您的import语句是函数的一部分,如下所示,您将无法获得Tab自动完成。您需要将import语句放在函数外部,并在要求对包进行自动完成之前执行它们一次。
def myfunction():
import pandas as pd
import numpy as np
a = pd.DataFrame(np.random.normal(1,3, (4,4))
return a