调用plt函数报错not ‘KeyboardModifier’

TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'

这个错误是由于在使用Matplotlib库时,尝试加载Qt相关的后端时发生了问题。根据错误信息,问题出现在导入backend_qt模块时。

这个错误通常是由于Matplotlib版本与其他相关库的兼容性问题导致的。可能的原因是Matplotlib版本与Qt库或其他依赖库版本不兼容。

确实只在这个库里安装了PySide6(6.4.2)和matplotlib(3.5.3)

解决方案:

代码开头增加下面2句:

c 复制代码
import matplotlib
matplotlib.use('TkAgg')
相关推荐
Flittly13 小时前
【从零手写 ClaudeCode:learn-claude-code 项目实战笔记】(3)TodoWrite (待办写入)
python·agent
千寻girling17 小时前
一份不可多得的 《 Django 》 零基础入门教程
后端·python·面试
databook21 小时前
探索视觉的边界:用 Manim 重现有趣的知觉错觉
python·动效
明月_清风1 天前
Python 性能微观世界:列表推导式 vs for 循环
后端·python
明月_清风1 天前
Python 性能翻身仗:从 O(n) 到 O(1) 的工程实践
后端·python
helloweilei2 天前
python 抽象基类
python
用户8356290780512 天前
Python 实现 PPT 转 HTML
后端·python
zone77392 天前
004:RAG 入门-LangChain读取PDF
后端·python·面试
zone77392 天前
005:RAG 入门-LangChain读取表格数据
后端·python·agent
树獭非懒2 天前
AI大模型小白手册|Embedding 与向量数据库
后端·python·llm