Bug--python画图

今天在画图的时候遇见了bug:

python 复制代码
import matplotlib.pyplot as plt

AttributeError: partially initialized module 'matplotlib.backends.backend_macosx' has no attribute 'FigureCanvas' (most likely due to a circular import)

原因:

画图的时候后端显示不正常,没有正常模块显示。

解决:

python 复制代码
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
  • matplotlib.use('TkAgg') 这行代码指定了 Matplotlib 使用 'TkAgg' 后端。后端是 Matplotlib 用来绘制图像的引擎或框架。
  • 'TkAgg' 是基于 Tkinter 的后端,Tkinter 是 Python 的标准 GUI(图形用户界面)工具包。使用 'TkAgg' 后端,可以在独立窗口中显示绘制的图形。
相关推荐
明雨-开发19 小时前
近期发生一个因为渲染导致的bug
bug
程序员小远20 小时前
软件测试之bug分析定位技巧
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·bug
眠りたいです21 小时前
基于脚手架微服务的视频点播系统-脚手架开发部分(完结)elasticsearch与libcurl的简单使用与二次封装及bug修复
c++·elasticsearch·微服务·云原生·架构·bug
困死了11111 天前
bug【celery】
bug·celery
阿奇__2 天前
el-table有固定列时样式bug
vue.js·elementui·bug
残花月伴3 天前
天机学堂——day1(修改bug)
servlet·bug
std860214 天前
微软 Win11 经典版 Outlook 曝 BUG,加速 SSD 损耗
microsoft·bug·outlook
花花鱼4 天前
android 网络访问拦截器使用后的bug处理
bug
JH30734 天前
MyBatis多表联查返回List仅一条数据?主键冲突BUG排查与解决
bug·mybatis
约翰先森不喝酒5 天前
Android BUG 之 资源文件报红但不影响运行
bug