【无标题】

本文介绍了在遇到OpenMP运行时错误#15时,如何在Anaconda虚拟环境中处理libiomp5md.dll的重复加载问题,包括删除多余DLL文件和设置环境变量KMP_DUPLICATE_LIB_OK。然而,后一种方法并不适用于所有情况。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

@[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'

提示:这个方法对我的报错没有用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值