这是一个不断踩坑的过程~~
首先,我开始的诉求是希望可以利用 openCV 实时显示电脑摄像头获取的内容。
开始用了 cv2.imshow() 结果不行。报错:
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
然后查了资料,说要同时用 cv2.waitKey(0),结果加上了以后还是一样报错~~
继续搜索解决方案,有提到要安装 opencv-python-headless
pip install opencv-python