资讯 小学 初中 高中 语言 会计职称 学历提升 法考 计算机考试 医护考试 建工考试 教育百科
栏目分类:
子分类:
返回
空麓网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
空麓网 > 计算机考试 > 软件开发 > 后端开发 > Python

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

Python 更新时间: 发布时间: 计算机考试归档 最新发布

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

1、解决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/.

解决办法1:

在pycharm里调试程序时可以直接通过在程序前添加这两个语句解决

import osos.environ[“KMP_DUPLICATE_LIB_OK”]=“TRUE”

解决办法2:

办法1不能解决问题的话,甚至直接在terminal上import torch也会出现这种问题:

究其原因其实是,anaconda的环境下存在两个libiomp5md.dll文件。所以直接去虚拟环境的路径下搜索这个文件,可以看到在环境里有两个dll文件:

其中第一个是torch路径下的,第二个是虚拟环境本身路径下的,转到第二个目录下把它剪切到其他路径下备份就好(最好把路径也备份一下)。

2、ModuleNotFoundError: No module named ‘mmcv._ext‘解决方案

使用目标检测开源工具MMDetection时,出现如下报错:

ModuleNotFoundError: No module named 'mmcv._ext'

很有可能是你在开始安装mmcv-full的时候,没有指定版本,选择直接安装,如下:

pip install mmcv-full

采用这样默认安装mmcv-full的方式,如果与你环境里的cuda和torch版本不匹配,就容易出现上面报错

卸载掉原来的mmcv

pip uninstall mmcv-full

重新安装正确版本的mmcv-full

其中,{cu_version}、{torch_version}分别对应cuda和torch的版本号

pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html

例如,我安装的是cuda10.2、pytorch1.8.0,所以应该输入命令:

pip install mmcv-full==1.2.4 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.0/index.html

注意:mmcv-full我这里推荐用1.2.4版本的。

转载请注明:文章转载自 http://www.konglu.com/
本文地址:http://www.konglu.com/it/1094523.html
免责声明:

我们致力于保护作者版权,注重分享,被刊用文章【OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.】因无法核实真实出处,未能及时与作者取得联系,或有版权异议的,请联系管理员,我们会立即处理,本文部分文字与图片资源来自于网络,转载此文是出于传递更多信息之目的,若有来源标注错误或侵犯了您的合法权益,请立即通知我们,情况属实,我们会第一时间予以删除,并同时向您表示歉意,谢谢!

我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2023 成都空麓科技有限公司

ICP备案号:蜀ICP备2023000828号-2