Mac下Jupyter Notebook中运行cv2.imshow()出现“服务器似乎挂掉了,但是会立刻重启的”

时间:2024-05-22 11:22:29

使用python访问图像信息,运行到cv2.imshow()的代码段时运行中止,点击启动Jupyter Notebook的终端程序,终端上会记录Jupyter Notebook的运行信息,最后几行显示错误提示

You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
qt.qpa.plugin: Could not load the Qt platform plugin “cocoa” in “” even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: cocoa, minimal, offscreen.

解决办法:pip install opencv-python-headless
Mac下Jupyter Notebook中运行cv2.imshow()出现“服务器似乎挂掉了,但是会立刻重启的”
再次打开Jupyter Notebook,程序就可以顺利运行了。