【问题标题】:Jupyter notebook python3 kernel not connecting on some files onlyJupyter notebook python3内核仅连接某些文件
【发布时间】:2020-07-15 21:59:03
【问题描述】:

我刚刚重新安装了 anaconda。

当我尝试打开一个新的空白文件时,内核连接并且没有出现导入错误。 但是当我尝试打开一个其他人可以打开的更大文件时,内核永远无法连接,我尝试通过 anaconda 终端启动它,这是我收到的错误消息:

  File "/Users/pierre/opt/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/pierre/opt/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/ipykernel/connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/IPython/__init__.py", line 55, in <module>
    from .core.application import Application
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/IPython/core/application.py", line 25, in <module>
    from IPython.core import release, crashhandler
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/IPython/core/crashhandler.py", line 27, in <module>
    from IPython.core import ultratb
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/IPython/core/ultratb.py", line 115, in <module>
    from IPython.core import debugger
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/IPython/core/debugger.py", line 47, in <module>
    from pdb import Pdb as OldPdb
  File "/Users/pierre/opt/anaconda3/lib/python3.7/pdb.py", line 76, in <module>
    import code
  File "/Users/pierre/Documents/facultee/DL2/miniProjet/projects/OCEAN/starting_kit/code.py", line 193, in <module>
    featureSelection(D)
  File "/Users/pierre/Documents/facultee/DL2/miniProjet/projects/OCEAN/starting_kit/code.py", line 87, in featureSelection
    fig, ax = plt.subplots(2, 1, figsize=(20, 10))
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 1209, in subplots
    fig = figure(**fig_kw)
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/matplotlib/pyplot.py", line 545, in figure
    **kwargs)
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 3260, in new_figure_manager
    fig = fig_cls(*args, **kwargs)
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/matplotlib/figure.py", line 367, in __init__
    FigureCanvasBase(self)  # Set self.canvas.
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 1596, in __init__
    self._fix_ipython_backend2gui()
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 1623, in _fix_ipython_backend2gui
    ip = IPython.get_ipython()
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/IPython/core/getipython.py", line 22, in get_ipython
    from IPython.core.interactiveshell import InteractiveShell
  File "/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 45, in <module>
    from IPython.core.debugger import Pdb
ImportError: cannot import name 'Pdb' from 'IPython.core.debugger' (/Users/pierre/opt/anaconda3/lib/python3.7/site-packages/IPython/core/debugger.py)

在一个空白的新笔记本中,我可以正确地从 IPython.core.debugger 导入 Pdb,同时还可以导入标准的 python pdb。

规格: 我在更新的 MAC os-x 和 Windows 10 上有这个错误,jupyter notebook python 3 内核在我的 mac 上工作,直到我尝试为 vsc python 代码单元安装内核。 我使用 seaborn 作为附加库。

【问题讨论】:

    标签: python-3.x jupyter-notebook anaconda kernel ipython


    【解决方案1】:

    首先检查它打开的环境是否正确(通常当你打开一本新的空白书时,它打开的环境是base),是否安装了该库的所有模块。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-27
      • 2019-07-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-05
      相关资源
      最近更新 更多