1.症状
用matplotlib或者cv2里面的那个imshow之后,jupyter notebook直接“内核似乎挂掉了,他很快将自动重启”
然后conda的prompt里面是这样的:
2.分析(不想看可以忽略)
上面的prompt的意思如下:
•OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
CN:错误#15:正在初始化libiomp5md.dll,但发现libiomp5md.dll已经初始化了。
•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.
CN:注意!这意味着 OpenMP 运行时的多个副本已link到程序里。 这是危险的,因为它会降低性能或直接炸掉程序。
•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.
CN:最好只让一个 OpenMP链接到运行时的进程中,比如通过避免在任何lib中静态link到OpenMP。
•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.
CN:或者可以可以设置环境变量 KMP_DUPLICATE_LIB_OK=TRUE强行整出来结果。但这可能会导致干掉你的进程(比如现在)或悄咪咪地瞎输出莫名其妙的结果。
•For more information, please see http://www.intel.com/software/products/support/.
CN:你也可以看看intel的一个support
结论就是,libiomp5md.dll重复初始化了,所以让一个消失就行了。
3.解决方案
搜索这个dll,如图
别删错了,deeplearnings是我的环境,你自己环境叫啥名就找对应的,然后把Library\bin下面的那个libiomp5md.dll删掉就行(别TM把整个bin文件夹删掉!)
完事了