OpenCV是一个开源的跨平台计算机视觉库,可以运行在Linux、Windows、Android和Mac OS操作系统上。提供了Python、Ruby、MATLAB等语言的接口,并且实现了图像处理和计算机视觉方面的很多通用算法,可以给开发者调用。
mac上安装opencv时,一开始使用pip3 install python-opencv时报错,提示:No matching distribution found for python-opencv,使用pip3 install opencv,也报错,提示找不到opencv,如图
alicedembp:~ alice$ pip3 install python-opencv
Collecting python-opencv
Could not find a version that satisfies the requirement python-opencv (from versions: )
No matching distribution found for python-opencv
后来重新反过来试了一下pip3 install opencv-python,居然成功了 ,如图
alicedembp:~ alice$ pip3 install python-opencv Collecting python-opencv Could not find a version that satisfies the requirement python-opencv (from versions: ) No matching distribution found for python-opencv alicedembp:~ alice$ pip3 install opencv-python Collecting opencv-python Downloading https://files.pythonhosted.org/packages/8d/ff/13e77ee7ac431f831e20d81a6bf0214ca1cf550cf9b575e3213e14325c81/opencv_python-4.1.0.25-cp37-cp37m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (52.1MB) 100% |��������������������������������| 52.1MB 735kB/s Requirement already satisfied: numpy>=1.14.5 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from opencv-python) (1.16.1) Installing collected packages: opencv-python Successfully installed opencv-python-4.1.0.25 alicedembp:~ alice$
可以在终端使用命令行import cv2检验一下是否真的成功了
alicedembp:~ alice$ python Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>>
导入时无出错提示,确认已成功~也可通过cv2.__version__查看安装的版本,示例如下:
alicedembp:~ alice$ python Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '4.1.0'
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:mmqy2019@163.com进行举报,并提供相关证据,查实之后,将立刻删除涉嫌侵权内容。
长按识别二维码并关注微信
更方便到期提醒、手机管理