【BUG1记录】深度学习对数据进行拟合时图片不显示的问题

问题描述

在深度学习的过程中,难免会对数据进行拟合操作,在使用plt.plot(x, y)进行画图操作后,进行仿真运行时,并没有出现我们需要的图片。在加入plt.show()之后缺报错的问题。该问题是在进行只是向量机的数据模拟时出现的错误,但在其它数据拟合的代码中应该也会出现。

原因分析:

深度学习框架很多不是在windows系统下进行开发的,而我们的笔记本电脑更多是在windows环境下进行编码操作的,所以需要调用plt.show()方法来显示所需要的图片,当你看到这里,你觉得问题的答案找到,当你再次切回编译器,加上plt.show()之后,接下来编译器会出现下面的代码错误提示:

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, 

解决方案:

在你的代码的开头加上下面的代码文件就行了,再次运行就会出现图片了

import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'

测试结果:

在加入上述的plt.show()和解决方案中的代码后,我的程序得到了想要的结果,图片它跑出来了。
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/dxcn01/article/details/128711966