gpt4 book ai didi

python - 尝试使用 TkAgg 后端进行绘图时 Mac OS 崩溃

转载 作者:行者123 更新时间:2023-11-28 18:56:41 28 4
gpt4 key购买 nike

当我尝试使用 TkAgg 后端进行绘图时,我的计算机将我注销(“崩溃”)(请参见下面的示例)。我正在使用 mojave 10.14.6 和 python 3.7.3。

from sys import platform as sys_pf
if sys_pf == 'darwin':
import matplotlib
matplotlib.use("TkAgg")
x = [1,2,3]
# up to here the code does not cause a crash
plt.figure()
pl.plot(x)
plt.show()

最佳答案

遇到了类似的问题。我现在唯一的解决方法是使用

matplotlib.use("MacOSX")

关于python - 尝试使用 TkAgg 后端进行绘图时 Mac OS 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57422160/

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