Help us understand the problem. What is going on with this article?

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

結構悩んだので、忘備録

環境

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

参考

https://stackoverflow.com/questions/60032540/opencv-cv2-imshow-is-not-working-because-of-the-qt

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした