前言

本文的前提是你已经安装好了anaconda并且创建了一个虚拟环境。
下面我们来在这个虚拟环境中安装opencv。

一、下载opencv文件

在此网站(https://www.lfd.uci.edu/~gohlke/pythonlibs/)下载opencv的文件。
在这里插入图片描述
这里4.5.5指的是opencv的版本,cp39指的是你的python的版本,win_and64指的是64位的系统,win32指的是32位的系统。

在这么多的文件中寻找你对应的下载即可。

二、安装

在这里插入图片描述
打开Anaconda Prompt,使用activate命令进入你的虚拟环境,然后使用pip install命令安装你刚才下载的文件。

在这里插入图片描述

三、使用问题

安装成功后,如果你发现无法使用 import cv2 命令导入opencv包,但是查看 pip list却发现已经安装了opencv-python,很可能是你没有安装opencv的依赖包numpy和matplotlib。此时,你只需要在prompt下运行下面这行命令安装即可。

conda install numpy matplotlib

总结

本博客只是为了记录自己学习中遇到的问题所写,如果访客对此有疑问,欢迎评论区留言。

GitHub 加速计划 / opencv31 / opencv
238
21
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:4 个月前 )
1f47f5ba imgproc: replace assertion in cornerSubPix with descriptive error #28404 Replace CV_Assert with explicit bounds check for initial corners in cornerSubPix. This provides a descriptive runtime error instead of abrupt termination, improving error handling for Python and C++ users. No algorithmic or behavioral change for valid inputs. Fixes #25139 (Related to #7276). ### 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 - [x] 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. - [ ] The feature is well documented and sample code can be built with the project CMake 16 小时前
fba658b9 Improve precision of RotatedRect::points 1 天前
Logo

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

更多推荐