OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized问题解决

时间:2021-07-29
本文章向大家介绍OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized问题解决,主要包括OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized问题解决使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

jupyter notebokk报错情况出现背景:手动下载pytoch的whl安装文件,使用pip install pytorch.whl命令安装pytorch。

出现的原因是因为有两个重复的文件libiomp5md.dll在python环境中。

解决办法:

第一种:搜索anaconda安装文件夹,把另外一个不在torch库下的文件备份删除。

第二种:在代码中添加下面两行代码

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

错误官方提示:
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/.

每天进步一点点! ©版权声明 文章版权归作者所有,未经允许请勿转载。

原文地址:https://www.cnblogs.com/lfywork/p/15077005.html