os: Windows 7
Python version: 3.6
opencv-contrib-Python version: 3.4.5.20
After I install the library using pip install opencv-contrib-Python, I try import cv2 and it gave the error:
recursion is detected during loading of "cv2" binary extensions.
However if I execute pip install opencv-Python followed by pip install opencv-contrib-Python, there is no error.
But according to the doc, I think I only need to executepip install opencv-contrib-Python, isn't it?
Yes, only thing you need to do is run pip install opencv-contrib-python. I tested the command and the import worked on Windows 10. I have no reason to believe that it wouldn't work on Windows 7.
The error suggests that you have some broken OpenCV installation somewhere. Have you tried to install OpenCV manually? Please remove all OpenCV installations and do a fresh install preferably to a clean virtual environment.
The error is a known bug in OpenCV if you compiled and installed it manually: https://github.com/opencv/opencv/issues/13202
Yes, I had built opencv manually, maybe this messed my python environment(anaconda) up. I have reinstalled anaconda and the problem is fixed. Thanks.
Most helpful comment
The error is a known bug in OpenCV if you compiled and installed it manually: https://github.com/opencv/opencv/issues/13202