错误 #15:正在初始化 libiomp5md.dll,但发现 libiomp5md.dll 已经初始化

Bbe*_*apa 5 python

操作系统:Window10

我在 anaconda 中使用 spyder (python3.8),运行代码后,出现以下错误:

[SpyderKernelApp] WARNING | No such comm: df7601e106dd11eba18accf9e4a3c0ef
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/.
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

fal*_*zzo 11

我通过将 NumPy 升级到版本 1.23.4 解决了这个问题。

pip install numpy --upgrade
Run Code Online (Sandbox Code Playgroud)

这对我来说效果很好:)


小智 9

当 python 解释器中存在多个“libiomp5.dll”文件时,会出现此错误。我通过删除不在我正在使用的模块(PyTorch)内的所有文件版本来修复它。我想指出的是,如果您不知道自己在做什么,这可能会导致很多多处理问题,但我确信通过在 StackOverflow 上查找没有什么是不能解决的。

欲了解更多详情,请访问:https://www.programmerought.com/article/53286415201/


小智 7

导入 os os.environ['KMP_DUPLICATE_LIB_OK']='True'