我电脑上环境是Pyhon3.6,今天安装了下openCV

记录如下

一.openCV安装包的安装

下载安装包

下载地址:https://opencv.org/releases.html

我下载的版本是3.4.0

下载完成之后得到一个exe文件,双击打开解压到一个路径,推荐直接解压到D盘,后期设置方便一些。

解压之后得到两个文件夹,接下来在环境变量中加入opencv路径:“;D:\opencv\build\x86\vc12\bin”

(这一步很多教程都没提,一定要做,不然很多例子跑不起来。别问我怎么知道的,我花了一个多小时才搞明白....)

二.下载opencv库的安装

下载python opencv库

地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/

到里面搜opencv,找到自己python版本对应的包,要下载带contrib的包

我64位的系统,python3.6 下的如截图:

下载完成后,注意下文件名,我发现用迅雷下载此文件时,文件名会出现乱码。大家最好把这里文件名复制下,在迅雷里面重新命名下。浏览器好像没这个问题。

whl文件文件名不能改,必须和官方的一致,否则安装会报错。

下载完成后,使用如下命令进行安装。当然你也可以先创建一个虚拟环境

安装numpy

pip install numpy

切换到下载的whl文件所在目录,安装opencv:

pip install opencv_python-3.4.0+contrib-cp36-cp36m-win_amd64.whl

安装完成后,试试在Python端输入import cv2

看看有没有报错

GitHub 加速计划 / opencv31 / opencv
238
21
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:4 个月前 )
6950bedb Use Mat::total() in Darknet IO 3 天前
105a7747 doc: update image codec configuration reference (add AVIF, fix JPEG XL) #28393 This PR updates the build configuration documentation to: - Add AVIF to the supported format list (it was missing). - Clarify that some codecs (AVIF, JPEG XL) do not support BUILD_* options because OpenCV does not bundle their source code. - Update the description to include "write" capabilities for these formats. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake 4 天前
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐