Python PyCharm 公仔包! plt.figure\plot 在 Debug模式下停止工作,但在 Python 控制台上工作

标签 python matplotlib ubuntu pycharm python-3.8

新年快乐。
我正在使用熟悉的 matplotlib 库,并且不知从何而来,该图停止工作。奇怪的是,它只能在 PyCharm 的 Python 控制台上正常运行,但在调试时却不能。过去工作的口译员都没有工作。
PyCharm 在尝试加载时崩溃。
我正在使用 ubuntu 18、PyCharm 2021.3.1、matplotlib 库 3.5.1、Python 3.8/3.9/3.10
figure screen capture
我试图重新安装 PyCharm,但没有成功。
有没有人见过这个东西?有谁知道如何处理它?
谢谢你。

最佳答案

我检查了两个调试器之间的区别。
一位写道它使用'TkAgg'后端而不是 'QtAgg' enter image description here
这解决了它!

import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot as plt
plt.figure()
感谢 this thread .

关于Python PyCharm 公仔包! plt.figure\plot 在 Debug模式下停止工作,但在 Python 控制台上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70548767/

相关文章:

matplotlib - Jupyter 中的 Mathjax/Matplotlib 字体

python - 关于使用 NumPy 数组解析 CSV 文件的查询

Django : Run Django at system boot

mysql - 使用 bash 脚本在 CentOS 6 VM (Vagrant) 上安装 MySQL

python - 以 f-String 格式列出\n

Python - 比较两个数据帧之间的范围

python - 如何指定回调以处理不同的 matplotlib 子图

java - 如何在 Ubuntu 下安装 JDK 10?

python - 函数给出错误 ValueError : list. remove(x): x not in list

python - 更改 WxPython 应用程序 Mac 菜单栏标题?