解决Error #15: Initializing libiomp5.dylib, but found libomp.dylib already initialized.

在使用macOS进行python数据分析时,有可能会出现如下报错:

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

临时解决方案是在python运行环境中添加环境变量KMP_DUPLICATE_LIB_OK并设置为TRUE,pytcharm操作如下:

首先在右上角运行程序的选项中选择编辑配置:

然后点击环境变量文本框最右侧的选项按钮:

点击用户环境变量中的加号:

添加KMP_DUPLICATE_LIB_OK并设置为TRUE:

点击确定后,再次运行程序就可以关闭提示了

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注