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


pycharm中执行程序,错误官方提示:
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/.

解决办法:

第一种:搜索anaconda安装文件夹,

会发现在anoconda安装路径和pytorch下存在几个 libiomp5md.dll,只需要把pytorch下重复的删除即可,anoconda路径中保留,把另外一个不在torch库下的文件备份删除,保留torch库下的。

第二种:在代码中添加下面两行代码(在我电脑中,这种方法不可用,在其他环境下有的好用)

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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM