LoginSignup
18
8

More than 3 years have passed since last update.

python-opencvでQt plugin "cocoa"が見つからないというエラー

Posted at

結構悩んだので、忘備録

環境

Mac OS 10.15.3
Python 3.7.3 (by homebrew)
opencv-contrib-python 4.2.0.32 (by pip)
opencv-python 4.2.0.32 (by pip)

解決策

python-opencvを入れて貰い物のコードを試していたら、
下記のようなエラーが。

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_PLATFORM_PLUGIN_PATHなるものを設定しろ、という人が多かったが、自前の環境ではうまくいかず。

結局、opencv-python 4.1系にダウングレードしたら解決した。

pip3 install opencv-python==4.1.2.30
pip3 install opencv-contrib-python==4.1.2.30

参考

18
8
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
8