IPython(jupyter)中的完成现在可以工作了(意外的关键字参数'column')

2024-04-27 01:49:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用的是jupyter笔记本,它工作正常,但当我按TAB键时,自动完成功能不起作用。 我已经检查了StackOverflow中的所有类似案例,但没有一个解决方案适合我。 我也尝试过对:伊皮顿、伊皮克内尔、绝地和龙卷风进行“pip升级”,升级效果很好,但问题仍然存在。 我试过Firefox、Chrome和Edge。 当我按TAB键时,我可以在终端中看到这些错误:

[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\ipykernel\kernelbase.py", line 265, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\tornado\gen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\ipykernel\kernelbase.py", line 580, in complete_request
    matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\ipykernel\ipkernel.py", line 356, in do_complete
    return self._experimental_do_complete(code, cursor_pos)
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\ipykernel\ipkernel.py", line 381, in _experimental_do_complete
    completions = list(_rectify_completions(code, raw_completions))
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 484, in rectify_completions
    completions = list(completions)
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 1818, in completions
    for c in self._completions(text, offset, _timeout=self.jedi_compute_type_timeout/1000):
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 1861, in _completions
    matched_text, matches, matches_origin, jedi_matches = self._complete(
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 2029, in _complete
    completions = self._jedi_matches(
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\IPython\core\completer.py", line 1373, in _jedi_matches
    interpreter = jedi.Interpreter(
  File "c:\users\tomer\appdata\local\programs\python\python39\lib\site-packages\jedi\api\__init__.py", line 725, in __init__
    super().__init__(code, environment=environment,
TypeError: __init__() got an unexpected keyword argument 'column'

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


Tags: inpylibpackageslocallinesiteusers
3条回答

@techno1731的解决方案是次优的,因为它只是禁用了绝地武士,而不是解决根本问题

最新的绝地(0.18)版本与IPython 7.19不兼容,请参见this discussion。IPython:7.20(于2020年2月1日发布)和8.0(尚未发布)有一个兼容性修复程序

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

pip install -U "ipython>=7.20"

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

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

这将在今天的前两个Google结果中为您提供GitHub的相关问题

Note: this is a copy of my answer from Giant IPKernelApp Error Using Hydrogen in Atom question which indeed can appear unrelated given the Hydrogen/Atom setting. I will now vote to close all other questions on the topic as duplicate of this one.

不久前,当我在本地使用虚拟环境的机器上工作时,我在Jupyterlab遇到了同样的问题

这是一个绝地武士太慢(或者说要花很长时间)无法完成的问题,对我来说有效的方法是在笔记本顶部添加以下行(例如,你通常在导入的地方):

# Jedi not working
%config Completer.use_jedi = False

这应该能奏效

我用的是以前版本的绝地武士:

pip install jedi==0.17

这对我很有用

相关问题 更多 >