python3.6和python3.7环境下,亲测有效。
首先把pip版本改为21.2.2,然后uninstall所有opencv相关的库(contrib,contrib-headless,opencv以及它的headless),然后只安装contrib和opencv。
1.pip版本修改
在pycharm的interpreter编译器中可更换指定版本。
2.卸载重装
卸载所有相关contrib、headless等库
pip uninstall opencv-contrib-python
pip uninstall opencv-contrib-python-headless
pip uninstall opencv-python
pip uninstall opencv-python-headless
重装4.5.5.62版本
pip install opencv-contrib-python==4.5.5.62 opencv-python==4.5.5.62 -i https://pypi.douban.com/simple