You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

已安装Freetype 2.10.4,Matplotlib仍致Jupyter内核崩溃求助

解决Matplotlib导致Jupyter Notebook内核崩溃的方案(适配Python3.7.12+Freetype2.10.4)
  • 排查Matplotlib版本兼容性:Python3.7.12对应的Matplotlib稳定版本建议是3.5.x系列,过高版本可能存在适配问题。执行pip install matplotlib==3.5.3回退到兼容版本试试。
  • 切换Matplotlib后端:默认的TkAgg后端可能引发内核崩溃,在Notebook开头添加代码切换到Agg后端:
    import matplotlib
    matplotlib.use('Agg')
    import matplotlib.pyplot as plt
    
  • 清理Matplotlib缓存:删除用户目录下的.matplotlib文件夹(Windows路径:C:\Users\<你的用户名>\.matplotlib;Linux/macOS路径:~/.matplotlib),重启Notebook后再测试。
  • 重装Matplotlib及依赖:执行pip install --force-reinstall matplotlib,确保所有依赖没有缺失或损坏。
  • 用极简代码测试:先运行最基础的绘图代码验证问题是否存在:
    import matplotlib.pyplot as plt
    plt.plot([1,2,3])
    plt.show()
    
    若仍崩溃,建议创建全新的Python3.7虚拟环境,重新安装Jupyter和Matplotlib。

内容的提问来源于stack exchange,提问作者HCroll

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 06:54:06