其他分享
首页 > 其他分享> > Jupyter Notebook切换内核无法打开

Jupyter Notebook切换内核无法打开

作者:互联网

报错如下所示:

[I 18:13:05.891 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\ipykernel\__init__.py", line 5, in <module>
    from .connect import *  # noqa
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\ipykernel\connect.py", line 11, in <module>
    import jupyter_client
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\jupyter_client\__init__.py", line 6, in <module>
    from .asynchronous import AsyncKernelClient  # noqa
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\jupyter_client\asynchronous\__init__.py", line 1, in <module>
    from .client import AsyncKernelClient  # noqa
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\jupyter_client\asynchronous\client.py", line 6, in <module>
    from jupyter_client.channels import HBChannel
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\jupyter_client\channels.py", line 12, in <module>
    import zmq.asyncio
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\zmq\__init__.py", line 103, in <module>
    from zmq import backend
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\zmq\backend\__init__.py", line 31, in <module>
    raise original_error from None
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\zmq\backend\__init__.py", line 26, in <module>
    _ns = select_backend(first)
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\zmq\backend\select.py", line 31, in select_backend
    mod = import_module(name)
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "D:\Anaconda\Main\envs\tensorflow2.4.1\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
    from . import (
ImportError: DLL load failed while importing _device: 找不到指定的模块。

期间尝试了重装ipkernel、设置Anaconda环境变量等多种方法,均未解决问题。

经过阅读报错提示,确定是pyzmq版本问题,新建内核环境的pyzmq版本与base的pyzmq版本不一致导致。

重装了与base环境相同的pyzmq,成功启动内核。

标签:Jupyter,envs,py,Notebook,tensorflow2.4,内核,Anaconda,line,Main
来源: https://www.cnblogs.com/nephelo/p/16583755.html