Anaconda 下创建一个python3.6的虚拟环境,进入虚拟环境开始安装:
先安装 opencv-python
pip install opencv-python -i https://pypi.tuna.tsinghua.edu.cn/simple
安装过程:
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
然后安装opencv-contrib-python
pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple
安装过程文章来源:https://www.toymoban.com/news/detail-595460.html
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
此种方法安装后,import cv2 as cv后,代码可以正常运行文章来源地址https://www.toymoban.com/news/detail-595460.html
到了这里,关于python安装opencv的方法(快速简单安装)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!