jupyter出现问题ModuleNotFoundError: No module named ‘exceptiongroup‘

今天使用pyg的jupyter环境发现这个环境没法用, 所以只能把这个kernel给重删了然后再装,操作记录如下

查看kernel

jupyter kernelspec list

注意不是jupyter kernel --list 需要加关键字spec,

删除kernel

 jupyter kernelspec remove pyg

在这里插入图片描述

当重新安装这个kernel时可能会出错

python -m ipykernel install --name pyg


就出现了标题中的错误

  File "/home/zhangjingxiao/.conda/envs/pyg/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/zhangjingxiao/.conda/envs/pyg/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/zhangjingxiao/.local/lib/python3.9/site-packages/ipykernel/__main__.py", line 3, in 
    from ipykernel import kernelapp as app
  File "/home/zhangjingxiao/.local/lib/python3.9/site-packages/ipykernel/kernelapp.py", line 21, in 
    from IPython.core.application import (  # type:ignore[attr-defined]
  File "/home/zhangjingxiao/.local/lib/python3.9/site-packages/IPython/__init__.py", line 54, in 
    from .terminal.embed import embed
  File "/home/zhangjingxiao/.local/lib/python3.9/site-packages/IPython/terminal/embed.py", line 15, in 
    from IPython.core.interactiveshell import DummyMod, InteractiveShell
  File "/home/zhangjingxiao/.local/lib/python3.9/site-packages/IPython/core/interactiveshell.py", line 140, in 
    from exceptiongroup import BaseExceptionGroup
ModuleNotFoundError: No module named 'exceptiongroup'

其实这个错误解决起来很简单的

pip install exceptiongroup

然后重新执行
在这里插入图片描述

注意要加上--user然后就可以了,

你可能感兴趣的:(jupyter,python,windows)