報錯
OMP: 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/.
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
第二段的意思是說:提示這意味著已將OpenMP運行時的多個副本鏈接到程序中剑逃。 這很危險朦前,因為它會降低性能或?qū)е洛e誤的結(jié)果巾钉。 最好的辦法是確保僅將單個OpenMP運行時鏈接到該流程中惭笑,例如 通過避免在任何庫中靜態(tài)鏈接OpenMP運行時汞斧。 作為不安全滔驶,不受支持遇革,未記錄的解決方法,您可以設(shè)置環(huán)境變量KMP_DUPLICATE_LIB_OK = TRUE以允許程序繼續(xù)執(zhí)行揭糕,但可能導(dǎo)致崩潰或無提示地產(chǎn)生錯誤的結(jié)果萝快。
它提示設(shè)置環(huán)境變量,因此可以加入一下語句著角,然后即可成功運行:
import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"