@[TOC]OMP: Error #15:
OMP: Error #15:
代码报错显示如下:
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, please see http://www.intel.com/software/products/support/.
解决方法 1
在本地anaconda的虚拟环境下进行搜索:libiomp5md.dll
1.进入本地虚拟环境C:\Users\xxxx\anaconda3\envs\xxxxxx(虚拟环境)
2.如何进行libiomp5md.dll的搜索
我这样操作之后,发现本地搜到三个libiomp5md.dll文档。所以我删除了其中两个(删除前建议先备份一下)。
注意:我删除其中两个之后,再运行代码发现会报:DLL的错误。这时候需要再尝试恢复刚刚被删除的dll文档,也就是需要稍微排除一下究竟要删除哪个dll文档。
3.删除后再运行发现不报错了。
解决方法 2
在代码的开头添加下面一段代码:
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
提示:这个方法对我的报错没有用。