IPython(jupyter)中的完成现在可以工作(意外的关键字参数“列”)

我正在使用 jupyter notebook,它工作正常,但是当我按 TAB 时,自动完成不起作用。我已经在 StackOverflow 中检查了所有类似的情况,但没有一个解决方案对我有用。我还尝试对 IPython、IPYKernel、Jedi 和 Tornado 进行“pip 升级”,升级工作正常,但问题仍然存在。我在 Firefox、Chrome 和 Edge 中尝试过。当我按 TAB 时,我可以在终端中看到这些错误:

[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesipykernelkernelbase.py", line 265, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagestornadogen.py", line 762, in run
    value = future.result()
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagestornadogen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesipykernelkernelbase.py", line 580, in complete_request
    matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesipykernelipkernel.py", line 356, in do_complete
    return self._experimental_do_complete(code, cursor_pos)
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesipykernelipkernel.py", line 381, in _experimental_do_complete
    completions = list(_rectify_completions(code, raw_completions))
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesIPythoncorecompleter.py", line 484, in rectify_completions
    completions = list(completions)
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesIPythoncorecompleter.py", line 1818, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesIPythoncorecompleter.py", line 1861, in _completions
    matched_text, matches, matches_origin, jedi_matches = self._complete(
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesIPythoncorecompleter.py", line 2029, in _complete
    completions = self._jedi_matches(
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesIPythoncorecompleter.py", line 1373, in _jedi_matches
    interpreter = jedi.Interpreter(
  File "c:userstomerappdatalocalprogramspythonpython39libsite-packagesjediapi__init__.py", line 725, in __init__
    super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

如果有人能帮我处理这个案子,我会很高兴

回答

来自@techno1731 是次优的,因为它只是禁用绝地而不是修复潜在问题。

最新的绝地 (0.18) 版本与 IPython 7.19 不兼容,请参阅此讨论。IPython:7.20(2020 年 2 月 1 日发布)和 8.0(尚未发布)具有兼容性修复。

此时正确的解决方法是升级 IPython:

pip install -U "ipython>=7.20"

将来,您可以在删除特定于您的安装的所有路径片段后搜索引用的最后两行,这是搜索:

     super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

这将在前两个谷歌结果中为您提供 GitHub 上的相关问题,如今天。

注意:这是我从Giant IPKernelApp Error Using Hydrogen in Atom问题的回答的副本,考虑到 Hydrogen/Atom 设置,这确实看起来无关。我现在将投票结束与该主题相关的所有其他问题,作为该问题的重复问题。


回答

前段时间我在使用虚拟环境在我的机器上本地工作时使用 Jupyterlab 遇到了同样的问题。

这是 Jedi 加载完成速度太慢(或者说永远需要)的问题,对我有用的是在笔记本顶部添加以下行(例如,您通常进行导入的地方):

# Jedi not working
%config Completer.use_jedi = False

这应该可以解决问题。


以上是IPython(jupyter)中的完成现在可以工作(意外的关键字参数“列”)的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>