python - Error #15 : Initializing libiomp5. dylib,但发现 libiomp5.dylib 已经初始化

标签 python macos matplotlib

在使用 matplotlib 时获取错误信息:

Error #15: Initializing libiomp5.dylib, but found libiomp5.dylib 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/.

最佳答案

执行以下操作来解决问题:

import os

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

答案位于:https://github.com/dmlc/xgboost/issues/1715

注意潜在的副作用:

but that may cause crashes or silently produce incorrect results.

关于python - Error #15 : Initializing libiomp5. dylib,但发现 libiomp5.dylib 已经初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53014306/

相关文章:

python - PySide 和 QProgressBar 在不同的线程中更新

python - pandas HDFStore - 如何重新打开?

objective-c - 标准(32/64 位通用)、WebKit、Flash 插件和 Leopard

python - 使用 scipy、matplotlib 将数据拟合到多峰分布

python - 如何计算 pandas 工作日的使用情况

python - Matplotlib:混合导出为 pdf 和 png

Python/Django 模型

java - 如何在Java的类构造函数中两次使用Scanner?

c++ - Qt 的编译警告 - 仅限 Mac OS X : <class> is already a friend of <class>

macos - 在 Mac OSX 中添加区域设置