Jupyter matplotlib 画图就kernel died 问题解决

  jupyter一画图就卡死, 类似下面的代码,运行会导致 kernel died     Jupyter matplotlib 画图就kernel died 问题解决Jupyter matplotlib 画图就kernel died 问题解决

 

 

  运行如上所示的代码,没有图形出来。实际上看jupyter的log,kernel已经died了 日志如下;    


Info 2021-12-07 15:11:03: Execute Cells request 2 1, 2
Info 2021-12-07 15:11:03: Execute Cell 1 file:///f%3A/pythonCode/juptyerCode//plot2.ipynb
Info 2021-12-07 15:11:03: Execute Cell 2 file:///f%3A/pythonCode/juptyerCode//plot2.ipynb
Info 2021-12-07 15:11:03: KernelProcess output: Content-Length: 137
Content-Type: application/vscode-jsonrpc; charset=utf8

{"jsonrpc": "2.0", "method": "log", "params": {"level": "WARNING", "msg": "Kernel has exited with exit code 3221225477, ", "pid": 22404}}Content-Length: 94
Content-Type: application/vscode-jsonrpc; charset=utf8

{"jsonrpc": "2.0", "method": "kernel_died", "params": {"exit_code": 3221225477, "reason": ""}}
Warn 2021-12-07 15:11:03: Python Daemon (pid: 22404): Kernel has exited with exit code 3221225477,
Error 2021-12-07 15:11:03: Kernel died [s [Error]: Kernel died (code: 3221225477). FutureWarning),
D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
FutureWarning)
D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.
FutureWarning)

at c:\Users\Admin\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:793230
at c:\Users\Admin\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:466054
at c:\Users\Admin\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:466272
at Immediate._onImmediate (c:\Users\Admin\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:467837)
at processImmediate (internal/timers.js:461:21)] {
category: 'kerneldied',
stdErr: `D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\lib\\site-packages\\traitlets\\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.\r\n` +
' FutureWarning)\r\n' +
`D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\lib\\site-packages\\traitlets\\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.\r\n` +
' FutureWarning)\r\n',
exitCode: 3221225477,
reason: `D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\lib\\site-packages\\traitlets\\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.\r\n` +
' FutureWarning)\r\n' +
`D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\lib\\site-packages\\traitlets\\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.\r\n` +
' FutureWarning)\r\n'
} D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
FutureWarning)
D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.
FutureWarning)

Error 2021-12-07 15:11:03: KernelProcess Exit Exit - 3221225477, D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
FutureWarning)
D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.
FutureWarning)
[s [Error]: Kernel died (code: 3221225477). FutureWarning),
D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
FutureWarning)
D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.
FutureWarning)

at c:\Users\Admin\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:793230
at c:\Users\Admin\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:466054
at c:\Users\Admin\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:466272
at Immediate._onImmediate (c:\Users\Admin\.vscode\extensions\ms-toolsai.jupyter-2021.10.1101450599\out\client\extension.js:66:467837)
at processImmediate (internal/timers.js:461:21)] {
category: 'kerneldied',
stdErr: `D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\lib\\site-packages\\traitlets\\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.\r\n` +
' FutureWarning)\r\n' +
`D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\lib\\site-packages\\traitlets\\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.\r\n` +
' FutureWarning)\r\n',
exitCode: 3221225477,
reason: `D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\lib\\site-packages\\traitlets\\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.\r\n` +
' FutureWarning)\r\n' +
`D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\lib\\site-packages\\traitlets\\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.\r\n` +
' FutureWarning)\r\n'
}
Error 2021-12-07 15:11:03: Disposing session as kernel process died ExitCode: 3221225477, Reason: undefined
Info 2021-12-07 15:11:03: Dispose Kernel process
Info 2021-12-07 15:11:03: kill daemon
Info 2021-12-07 15:11:03: KernelProcess output: Content-Length: 132
Content-Type: application/vscode-jsonrpc; charset=utf8

{"jsonrpc": "2.0", "method": "log", "params": {"level": "INFO", "msg": "Execute rpc method kill_kernel in DS Daemon", "pid": 22404}}
Info 2021-12-07 15:11:03: Python Daemon (pid: 22404): Execute rpc method kill_kernel in DS Daemon
Info 2021-12-07 15:11:03: KernelProcess output: Content-Length: 180
Content-Type: application/vscode-jsonrpc; charset=utf8

{"jsonrpc": "2.0", "method": "log", "params": {"level": "INFO", "msg": "Execute rpc method kill_kernel from D:\\progameFiles\\Anaconda3\\envs\\tf2.1gpu\\python.exe", "pid": 22404}}Content-Length: 129
Content-Type: application/vscode-jsonrpc; charset=utf8

{"jsonrpc": "2.0", "method": "log", "params": {"level": "INFO", "msg": "Kill kernel in DS Kernel Launcher Daemon", "pid": 22404}}Content-Length: 140
Content-Type: application/vscode-jsonrpc; charset=utf8

{"jsonrpc": "2.0", "method": "log", "params": {"level": "INFO", "msg": "Kill kernel in DS Kernel Launcher Daemon, pid 39208", "pid": 22404}}Content-Length: 43
Content-Type: application/vscode-jsonrpc; charset=utf8

{"jsonrpc": "2.0", "id": 2, "result": null}
Info 2021-12-07 15:11:03: Python Daemon (pid: 22404): Execute rpc method kill_kernel from D:\progameFiles\Anaconda3\envs\tf2.1gpu\python.exe
Info 2021-12-07 15:11:03: Python Daemon (pid: 22404): Kill kernel in DS Kernel Launcher Daemon
Info 2021-12-07 15:11:03: Python Daemon (pid: 22404): Kill kernel in DS Kernel Launcher Daemon, pid 39208
Info 2021-12-07 15:11:03: Dispose Kernel process
Info 2021-12-07 15:11:03: KernelProcess Exit Exit - 3221225477 D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2205: FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.
FutureWarning)
D:\progameFiles\Anaconda3\envs\tf2.1gpu\lib\site-packages\traitlets\traitlets.py:2160: FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use '0ac2f1f7-b974-4410-8c29-153e98ff6eb9' instead of 'b"0ac2f1f7-b974-4410-8c29-153e98ff6eb9"'.
FutureWarning)

    看到一篇文章:   kernel dead 用pytorch学习深度学习,运行老师给的代码,每次遇到要画图的环节,jupyter notebook一言不合就内核挂掉了…   试错 全网找解决方案,jupyter、ipkernel什么的全都是最新版本,anaconda分配内存、docket分配内存啥的全都试了一遍…试了整个晚上,都没有用。。心累   解决方案 ———————————————— 版权声明:本文为CSDN博主「时透透郎酱」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_43471082/article/details/119191052         最后我在 在*上面找到了答案: https://*.com/questions/65734044/kernel-appears-to-have-died-jupyter-notebook-python-matplotlib   0 I try the solution of this video, based on this post, and it worked for me:
  • Run Anaconda Prompt as administrator
  • conda install --yes freetype=2.10.4
    我最开始freetype没有限定版本, conda install --yes freetype 还是报错。按照上面的限定了版本号 2.10.4 。就解决问题了。   Matplotlib依赖freetype库。                  
上一篇:conda虚拟环境下pip install 和 conda install 的区别 以及 查看 和 修改 虚拟环境下运行路径


下一篇:Script file ‘D:\Anaconda3\envs\opencvEnv\Scripts\pip-script.py’ is not present 解决方法