Create a python3.6 virtual environment under Anaconda, enter the virtual environment to start the installation:
Install opencv-python first
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
Installation process:
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting opencv-python
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/48/c3/798bd7b8f78430f82ec0660b753106717e4e4bb8032ce56f77d8577cb24b/opencv_python-4.5.5.64-cp36-abi3-win_amd64.whl (35.4 MB)
|████████████████████████████████| 35.4 MB 218 kB/s
Collecting numpy>=1.13.3
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/ea/bc/da526221bc111857c7ef39c3af670bbcf5e69c247b0d22e51986f6d0c5c2/numpy-1.19.5-cp36-cp36m-win_amd64.whl (13.2 MB)
Installing collected packages: numpy, opencv-python
Successfully installed numpy-1.19.5 opencv-python-4.5.5.64
Then install opencv-contrib-python
pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple
Installation process
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting opencv-contrib-python
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2e/63/c02ffce9f182dd77fad7ee1f333a6a2aca1a5a2c14a683d30b5d2bd8d8db/opencv_contrib_python-4.5.5.64-cp36-abi3-win_amd64.whl (42.2 MB)
|████████████████████████████████| 42.2 MB 311 kB/s
Requirement already satisfied: numpy>=1.13.3 in c:\users\yang\.conda\envs\kivy\lib\site-packages (from opencv-contrib-python) (1.19.5)
Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-4.5.5.64
After this method is installed, after importing cv2 as cv, the code can run normally