在QtC++代码里写了调用python函数的代码,python函数负责使用matplotlib作图,其中用到了plt.imshow()
,于是Qt报错:
Starting a Matplotlib GUI outside of the main thread will likely fail.
This application failed to start because it could not find or load the Qt platform plugin "windows" in "".
解决办法:
matplotlib绘图时不实现图片只去生成图片,在import matplotlib
后添加一句matpoltlib.use('Agg')
即可。
参考: