此代码在一台机器上有效,但在另一台机器上无效。我似乎无法通过依赖项来隔离问题。
来自https://matplotlib.org/3.1.1/gallery/lines_bars_and_markers/simple_plot.html
的示例代码-
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
# Data for plotting
t = np.arange(0.0,2.0,0.01)
s = 1 + np.sin(2 * np.pi * t)
fig,ax = plt.subplots()
ax.plot(t,s)
ax.set(xlabel='time (s)',ylabel='voltage (mV)',title='About as simple as it gets,folks')
ax.grid()
fig.savefig("test.png")
plt.show()
-> TypeError:无法读取未定义的属性“ props”
此代码不会产生明确失败的堆栈跟踪。 TypeError:通过调用plt.show()返回。我尝试搜索此错误,但找不到任何报告。 (我添加了我正在处理的服务器上的visual-studio的屏幕截图。我可能会创建其他环境的docker,因为我首先应该这样做,以避免配置中断。)正确保存到文件。这只是plt.show()的问题。
np。版本 '1.17.2'
matplotlib。版本 '3.1.1'