python,

[Issue] Could not find the Qt platform plugin "cocoa" in ""

Tony Tony Follow Feb 13, 2020 · 1 min read
[Issue]  Could not find the Qt platform plugin
Share this

純粹記錄執行Opencv的程式碼時所遇到的問題,今天在MacOS的環境測試相關程式碼時,terminal拋出下面這條錯誤訊息:

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.

[1]    2682 abort      python

trace後發現問題出在cv2.imread的function。

網路上的建議解法有:

  1. reinstall qt
     brew reinstall qt
    

    重新安裝後仍然出現錯誤。

  2. 安裝 opencv-python-headless
     pip install opencv-python-headless
    

    安裝後成功解決問題。

Join Newsletter
Get the latest news right in your inbox. We never spam!
Tony
Written by Tony Follow
Hi, I am Tony, the author of Learning Journey blog. I hope you like what I sharing!