Python如何安装CV2

Python014

Python如何安装CV2,第1张

第一步:用win+R打开cmd

升级pip版本  命令:python -m pip install --upgrade pip

后输入pip install cv2

无法解决问题,出现ERROR

ERROR: Could not find a version that satisfies the requirement cv2 (from versions: none)

ERROR: No matching distribution found for cv2

第二步:后输入pip install opencv-contrib-python

出现了与本机Python编译器一样的版本,成功!

       第一次安装cv2 模块的时候可能会犯这样的错误,输入pip(3) install cv2命令后,cv2并没有开始安装,而是返回这样一个错误:

Could not find a version that satisfies the requirement cv2 (from versions: )No matching distribution found for cv2

这是为什么呢?

其实,cv2的正确安装命令应该是这样的:

pip(3) install opencv-python

输入这个命令后,就可以正确安装cv2模块啦。