[英]When I use matplotlib in jupyter notebook,it always raise “ matplotlib is currently using a non-GUI backend” error?
[英]matplotlib is throwing segmentation fault when running on non-gui machine(web server)
使用marplotlib库时,我想保存图像而不显示绘图图像。 这是我已经尝试了一段时间的示例示例。
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(10))
extent = ax.get_window_extent().transformed(fig.dpi_scale_trans.inverted())
fig.savefig('temp.jpg', format='jpg', bbox_inches=extent, pad_inches=0)
但是我得到这个错误,
The program received signal SIGSEGV, Segmentation fault.
我使用gdb工具进行调试,出了错。.然后我可以看到此错误日志...
Program received signal SIGSEGV, Segmentation fault.
copy_hline (c=..., len=27822, y=19297, x=0, this=0x364f9a8) at extern/agg24-svn/include/agg_pixfmt_rgba.h:1741
1741 extern/agg24-svn/include/agg_pixfmt_rgba.h: No such file or directory.
我不知道为什么会这样。 任何帮助,对此表示赞赏。
我正在使用matplotlib'1.5.3'。
通过将matplotlib库升级到2.0.0,我能够解决此问题。
pip install matplotlib==2.0.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.