Error that Qt plugin "cocoa" cannot be found in python-opencv

I was worried quite a bit, so a memorandum

environment

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)

solution

If you put python-opencv and try the code of the gift, I get the following error.

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.

When I looked it up, many people asked me to set the environment variable QT_QPA_PLATFORM_PLUGIN_PATH, but it didn't work in my own environment.

After all, it was solved when I downgraded to opencv-python 4.1 series.

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

reference

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

Recommended Posts

Error that Qt plugin "cocoa" cannot be found in python-opencv
Dealing with the error that HTTP fetch error occurs in gpg and the key cannot be obtained
[Python] It seems that global variables cannot be referenced in Multiprocessing
What to do when "OS Error: [WinError 126] The specified module cannot be found" appears in import torch
Error in deep learning "ImportError: DLL load failed: The specified module cannot be found. How to know the "specified module" in.
Ll load failed in Anaconda environment construction: The specified module cannot be found. (import numpyas np file ....) Note that the error has been resolved.
Items that cannot be imported with sklearn
A solution to the problem that the Python version in Conda cannot be changed
Let's look at a differential equation that cannot be solved normally in Python