首页 > 解决方案 > 为什么 matplotlib 停止在 Fedora 上工作?

问题描述

我正在尝试在 Fedora 上使用 matplotlib,但不断收到类似

QSocketNotifier: Can only be used with threads started with QThread

即使使用 MWE

import matplotlib.pyplot as plt;
fig = plt.figure();

对于更复杂的脚本,它会引发分段错误。在 Ubuntu 上一切正常。有谁知道这里发生了什么?

标签: pythonmatplotlibfedora

解决方案


在 Fedora 上使用 matplotlib 时我收到同样的错误,但它仍然可以正常工作。

import matplotlib.pyplot as plt
plt.plot([1,2])
plt.show()

/usr/bin/python /home/djohnson/R/Working/foo.py [djohnson@julian Working]$ /usr/bin/python /home/djohnson/R/Working/foo.py QSocketNotifier:只能与以 QThread qt.qpa.wayland 开头的线程:Wayland 不支持 QWindow::requestActivate()

输出图

你运行 plt.show() 了吗?


推荐阅读