深度学习报错Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.的解决方法

python进行深度学习时,运行程序报错

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/.

这个问题表示libiomp5md.dll(OpenMP运行时库)被重复初始化。

根据报错信息最简单的处理方法是在程序前面添加:

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

这样就跳过了问题,程序可以成功运行。

或者使用https://cloud.tencent.com/developer/article/2542156 里面的方法,直接删除多余的dll。

但是感觉这样只是治标不治本,并没有解决问题,于是一行一行地处理程序,发现问题出现在调用matplotlib包的时候。

看到有人说matplotlib影响,那么可以尝试一下该命令conda install nomkl 对该包进行安装,看是否能解决问题。查了一下nomkl 是 conda 包管理器中一个已弃用的元包‌,主要用于控制 Python 科学计算库是否使用 Intel MKL 加速库,不是普通的功能包,而是一个"切换开关"类型的元包,用来告诉 conda 在安装 NumPy、SciPy 等库时选择非 MKL 版本 。‌‌‌

所以重新安装或更新涉及到 MKL 的库(如 NumPy)可以解决冲突问题。所以我更新了这个环境中的这两个库:pip install --upgrade numpy matplotlib

再次运行,成功解决问题,不再出现Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值