gpt4 book ai didi

python - 如何修复 : "Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created." warning

转载 作者:太空宇宙 更新时间:2023-11-03 23:56:37 25 4
gpt4 key购买 nike

每当我尝试使用 Matplotlib 绘制任何东西时,我都会收到此警告。

Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.

有人知道怎么解决吗?

尝试用谷歌搜索与 Matplotlib 中的 Qt 绑定(bind)相关的任何问题 - 仍然无法解决这个问题。

这是一个会产生警告的简单代码

import numpy as np
import matplotlib.pyplot as plt

a = np.arange(1000) # the distribution doesn't matter
plt.hist(a) # here could plt.scatter or plt.plot - would still get same error.
plt.show()

最佳答案

这可以通过将 matplotlib 更新到最新版本来解决。首先,使用以下方法删除旧版本:

pip uninstall matplotlib

然后,使用以下命令安装最新版本:

pip install matplotlib

关于python - 如何修复 : "Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created." warning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57457160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com