在控制台中运行Python 3.6
Jupyter
笔记本时出现此错误。
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/.
我有ligomp
的几种不同版本:
(µ_env) jespinozlt-osx:lib jespinoz$ pwd
/Users/jespinoz/anaconda/envs/µ_env/lib
(µ_env) jespinozlt-osx:lib jespinoz$ ls -lhtr | grep "omp"
-rw-rw-r-- 4 jespinoz tigr 165B Oct 28 2016 libgomp.spec
-rw-rw-r-- 4 jespinoz tigr 108K Oct 28 2016 libgomp.a
-rwxrwxr-x 11 jespinoz tigr 62K Oct 28 2016 libgomp.1.dylib
-rwxrwxr-x 6 jespinoz tigr 489K Oct 27 17:30 libomp.dylib
-rwxrwxr-x 5 jespinoz tigr 176K Mar 14 13:10 libiompstubs5.dylib
-rwxrwxr-x 5 jespinoz tigr 296K Mar 14 13:10 libiomp5_db.dylib
-rwxrwxr-x 5 jespinoz tigr 2.7M Mar 14 13:10 libiomp5.dylib
lrwxr-xr-x 1 jespinoz tigr 15B Apr 10 14:51 libgomp.dylib -> libgomp.1.dylib
一个快速补丁是:
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
如何正确解决此问题?我需要删除我的整个conda并重新开始吗?
答案 0 :(得分:0)
我遇到了这个问题,并尝试了https://github.com/dmlc/xgboost/issues/1715中描述的许多解决方案。
亚历克斯·埃弗斯(Alex Evers)的帖子(1ps0在2029年2月16日发表了评论)对我有用。
brew uninstall libiomp clamp-omp
conda uninstall intel-openmp -n base
conda install -c intel openmp -n myenv
conda install nomkl -n myenv
答案 1 :(得分:-2)
我从同一来源https://github.com/dmlc/xgboost/issues/1715找到了解决方案
这似乎是macOS特有的问题。
对我有用的是在开头添加以下代码行。
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
PS。 我在运行Keras神经网络时遇到了这种情况。