OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

目录

一、问题描述

二、原因分析

三、解决办法


一、问题描述

最近再Pycharm运行代码是遇到下面的报错: 

具体报错内容粘贴出来如下:

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

上述报错翻译成中文:

提示 这意味着OpenMP运行时的多个副本已经被链接到程序中。这是很危险的,因为它可能会降低性能或者导致不正确的结果。最好的办法是确保只有一个OpenMP运行时被链接到程序中,例如,避免在任何库中静态链接OpenMP运行时。作为一个不安全的、不被支持的、没有记录的变通方法,你可以设置环境变量KMP_DUPLICATE_LIB_OK=TRUE来允许程序继续执行,但是这可能会导致崩溃或者默默地产生不正确的结果。欲了解更多信息,请参见http://www.intel.com/software/products/support/。

二、原因分析

从翻译结果看,报错的主要原因是OpenMP运行时的多个副本已经被链接到程序中,它可能会降低性能或者导致不正确的结果。

三、解决办法

在Pycharm代码中加入下面两句代码:

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

再次运行,没有报错: 

并生成了图像:

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Dr.Petrichor

作者逐个题目分析的噢

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值