OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.报错解决办法。

报错信息:

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

在使用Jupyter Notebook 运行代码时候很久没有跑出来,重新使用py文件运行报了以上的错误。

这个错误的主要原因是由于在应用程序中同时加载了两个或多个版本的libiomp5md.dll库文件。
libiomp5md.dll 是Intel OpenMP运行库的一部分,用于支持并行计算任务。当系统中同时存在多个版本的库文件时,会导致冲突,从而引发错误。

解决方法:

1、找到下载的anconda中的libiomp5md.dll库文件,如果有相同的对第二个改名即可。
2、直接在代码前面加两行代码:

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

这行代码是确保只有一个OpenMP运行时被链接到进程中,将环境变量**KMP_DUPLICATE_LIB_OK=TRUE**设置为允许程序继续执行。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值