OpenCV2報錯:Could not find the Qt platform plugin "cocoa" in ""

OpenCV2報錯:Could not find the Qt platform plugin "cocoa" in ""


一.背景信息

在這裏插入圖片描述

OpenCV是一個基於BSD許可(開源)發行的跨平臺計算機視覺庫,可以運行在Linux、Windows、Android和Mac OS操作系統上。它輕量級而且高效——由一系列 C 函數和少量 C++ 類構成,同時提供了Python、Ruby、MATLAB等語言的接口,實現了圖像處理和計算機視覺方面的很多通用算法。今天在安裝OpenCV2時出現了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.的錯誤,解決並記錄於此,具體錯誤現象如下


二.錯誤現象

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.

三.解決方法

第一種解決方法:

pip install opencv-python==4.0.0.21  ####安裝舊版本的OpenCV2

第二種解決方法:

pip uninstall opencv-python    ####卸載已經安裝的最新版本
pip install opencv-python-headless  ####然後安裝非官方的OpenCV2庫
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章