jupyter-notebook 解决代码提示报错问题

[IPKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 261, in dispatch_shell
    yield gen.maybe_future(handler(stream, idents, msg))
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/tornado/gen.py", line 762, in run
    value = future.result()
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/tornado/gen.py", line 234, in wrapper
    yielded = ctx_run(next, result)
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/tornado/gen.py", line 162, in _fake_ctx_run
    return f(*args, **kw)
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/ipykernel/kernelbase.py", line 576, in complete_request
    matches = yield gen.maybe_future(self.do_complete(code, cursor_pos))
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 356, in do_complete
    return self._experimental_do_complete(code, cursor_pos)
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/ipykernel/ipkernel.py", line 381, in _experimental_do_complete
    completions = list(_rectify_completions(code, raw_completions))
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/IPython/core/completer.py", line 484, in rectify_completions
    completions = list(completions)
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/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 "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/IPython/core/completer.py", line 1862, in _completions
    full_text=full_text, cursor_line=cursor_line, cursor_pos=cursor_column)
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/IPython/core/completer.py", line 2030, in _complete
    cursor_pos, cursor_line, full_text)
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/IPython/core/completer.py", line 1374, in _jedi_matches
    text[:offset], namespaces, column=cursor_column, line=cursor_line + 1)
  File "/Users/wys/opt/anaconda3/envs/tf/lib/python3.6/site-packages/jedi/api/__init__.py", line 726, in __init__
    omitted, Jedi will be clever and try to define the range itself.
TypeError: __init__() got an unexpected keyword argument 'column'

根据报错可以看出是 jedi 的工具包出现了问题,经过网上查询,ipython 目前最新的版本无法正确调用最新的 jedi 0.18.0 版本,那就把 jedi 版本降级到 0.17 即可。

通过 conda 检索已安装的jedi版本:

conda list|grep jedi

发现果然是 0.18 版本,然后改装成 0.17

conda install jedi=0.17

重新启动 jupyter-notebook ,解决问题。

你可能感兴趣的:(技术文章,jupyter)