TAB completion does not work in Jupyter Notebook but fine in iPython terminal

▼魔方 西西 提交于 2019-12-20 08:57:48

问题


TAB completion works fine in iPython terminal, but not in Firefox browser.

So far I had tried but failed,

1). run a command $ sudo easy_install readline,

then the .egg file was wrote in /usr/local/lib/python2.7/dist-packages/readline-6.2.4.1-py2.7-linux-x86_64.egg,

but TAB completion still doesn't work in Jupyter Notebook.

2). also tried to find locate the ipython_notebook_config.py or ipython_config.py, but failed.

I use Python 3.5 and iPython 4.0.0. and both are installed in Ubuntu 15.10 /usr/share/anaconda3/bin/ipython.

Any help would be appreciated!


回答1:


My problem was in that I try to call autocomplete and import in the same cell. Because of imported thing does not initialized yet, autocomplete does not work.

All I need is call to the object in a new cell

UPD: or just run program once in the same cell to initialize imported




回答2:


In my case I installed miniconda on Debian Linux and most likely had a problem with the previous Python that was included with Debian. The following lines solved my problem:

conda update conda
conda update --all

The solution was taken from here based on the error that I had in IPython in terminal after writing np.<tab>:

No such file or directory: '/home/user/miniconda3/lib/python' 



回答3:


In my case, after running pip install pyreadline, I needed to re-execute all the lines in Jupyter before the completion worked. I kept wondering why it worked for IPython but not Jupyter.




回答4:


you can add

%config IPCompleter.greedy=True

in the first box of your Jupyter Notebook.




回答5:


The workaround I found is to assign the intermediate result to a temporary variable.then in seperate cell, using tab on temporary variable for auto-completion.

temp = pd.Description

temp.TAB




回答6:


faced the same problem, for me the following worked

conda install -c anaconda jedi


来源:https://stackoverflow.com/questions/33665039/tab-completion-does-not-work-in-jupyter-notebook-but-fine-in-ipython-terminal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!