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.
我在将自己的MacOS重新安装一下后,想测试一下Python的opencv能不能用
然后就 pip install opencv-python
果不其然,在我测试打开摄像头代码的时候报了一个
qt.qpa.plugin: could not find the qt platform plugin “cocoa” in “”
当时各种Goole,百度都用上了。
最后得到的解决方法是
pip install opencv-python-headless
1
就行了
==========
应该是版本的问题,最新版的opencv可能少了这个。
也可以安装其他老版的opencv来解决
pip install opencv-python==4.0.0.21
在MacOS上使用Python的OpenCV时遇到'qt.qpa.plugin: could not find the qt platform plugin "cocoa" in ""'错误。重新安装应用或尝试安装'opencv-python-headless'可以解决问题。这可能是由于版本问题导致,旧版本如4.0.0.21也可能避免该问题。

被折叠的 条评论
为什么被折叠?



