[英]In jupyter notebook, pressing tab print “ipynb_checkpoints/” instead of auto-completion
[英]Jupyter auto-completion/suggestions on tab not working
在使用像 nltk 這樣的庫時,選項卡自動完成就像一種祝福,它可以輕松地列出正在使用的模塊的功能和屬性。 幾個月前它曾經工作得很好,但最近我一直面臨這個自動完成沒有出現的新問題。 它們最初似乎工作正常,但一段時間后,內核活動指示器只是在按下 Tab 鍵時閃爍,而沒有任何反應。 在 jupyter 服務器端,出現以下消息:
[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "<the path>\venv\lib\site-packages\ipykernel\kernelbase.py", line 268, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "<the path>\venv\lib\site-packages\tornado\gen.py", line 735, in run
value = future.result()
File "<the path>\venv\lib\site-packages\tornado\gen.py", line 209, in wrapper
yielded = next(result)
File "<the path>\venv\lib\site-packages\ipykernel\kernelbase.py", line 583, in complete_request
matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))
File "<the path>\venv\lib\site-packages\ipykernel\ipkernel.py", line 360, in do_complete
return self._experimental_do_complete(code, cursor_pos)
File "<the path>\venv\lib\site-packages\ipykernel\ipkernel.py", line 385, in _experimental_do_complete
completions = list(_rectify_completions(code, raw_completions))
File "<the path>\venv\lib\site-packages\IPython\core\completer.py", line 484, in rectify_completions
completions = list(completions)
File "<the path>\venv\lib\site-packages\IPython\core\completer.py", line 1819, in completions
if c and (c in seen):
File "<the path>\venv\lib\site-packages\IPython\core\completer.py", line 1876, in _completions
else:
File "<the path>\venv\lib\site-packages\IPython\core\completer.py", line 991, in _make_signature
return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for p in completion.params) if f])
File "<the path>\venv\lib\site-packages\IPython\core\completer.py", line 991, in <listcomp>
return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for p in completion.params) if f])
File "<the path>\venv\lib\site-packages\IPython\core\completer.py", line 991, in <genexpr>
return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for p in completion.params) if f])
File "<the path>\venv\lib\site-packages\IPython\core\completer.py", line 968, in _formatparamchildren
raise ValueError('Jedi function parameter description have change format.'
ValueError: Jedi function parameter description have change format.Expected "param ...", found 'def __subclasshook__'".
雖然這不會嚴重阻礙開發過程,但如果它工作正常,它會非常有幫助。
我目前正在使用 python 3.8.6 64 位(在舊版本上也面臨同樣的問題)並在 Microsoft Edge Chromium 中運行筆記本
絕地是這里的問題。
你可以通過 jupyter 魔法解決這個問題。 只需在筆記本頂部添加以下內容:
%config Completer.use_jedi = False
另一種處理方法是刪除系統上的絕地緩存( https://github.com/ipython/ipython/issues/12134#issuecomment-590952054 ):
您需要清除絕地緩存:只需刪除文件夾(linux)
~/.cache/jedi/
你應該沒事的。
對於其他操作系統,請檢查
https://jedi.readthedocs.io/en/latest/docs/settings.html#filesystem-cache
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.