Python openCV qt.qpa.plugin: could not find the qt platform plugin "cocoa" in "" 錯誤在MacOS上的解決方法

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   
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章