1.
!pip install "opencv-python-headless<4.3"
2.
pip list | grep opencv
pip install --upgrade opencv-python
pip install --upgrade opencv-contrib-python
pip install --upgrade opencv-python-headless
pip install mmcv-full==1.2.7 -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html
链接:ImportError: cannot import name '_registerMatType' from 'cv2.cv2' · Issue #591 · opencv/opencv-python · GitHub
My problem was related to diferent versions of opencv modules. You can check it with:
pip list | grep opencv
upgrading all modules to the same version solved my error:
pip install --upgrade opencv-python pip install --upgrade opencv-contrib-python pip install --upgrade opencv-python-headless