1.建议先安装好Anaconda。

Scrapy第二(①)篇python环境之依赖管理器Anaconda(python3.9)_苍穹之跃的博客-

2.安装命令 (可能直接就安装成功了)

pip3 install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple

3.如果有skbuild,cmake等依赖库报错,则先安装依赖。

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple scikit-build
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple cmake

4.再次安装即可

pip3 install opencv-python
pip3 install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple

 

5.查看opencv-python版本 

import cv2
if __name__ == '__main__':
    version = cv2.__version__
    print(version)

6.顺便把matplotlib也安装一下:

pip install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple

OpenCV第一篇:安装(windows11)_依赖管理