Python3.7中安装openCV库的方法

时间:2022-11-24 14:03:55

1.首先自己直接在cmd中输入 pip3 install openCV是不可行的,即需要自己下载安装包本地安装

2.openCV 下载地址http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

3.opencv_python‑3.4.2‑cp37‑cp37m‑win_amd64.whl(cp37指的是python的版本,win_amd64是指python是64位的,也有可能有人64位的系统装了32位的python,这时候就需要装win32的版本)

4.下载完成后,在cmd中输入pip3 install 文件路径\opencv_python‑3.4.2‑cp37‑cp37m‑win_amd64.whl

5.如果出现错误opencv_python‑3.4.2‑cp37‑cp37m‑win_amd64.whl is not a supported wheel on this platform. 在cmd中可以通过下面的代码查询自己的python所能支持的版本,然后再选择适合自己的版本

?
1
2
3
4
5
6
7
#AMD_64
import pip._internal
print(pip._internal.pep425tags.get_supported())
#Win32
import pip
print(pip.pep425tags.get_supported())
[('cp37', 'cp37m', 'win_amd64'), ('cp37', 'none', 'win_amd64'), ('py3', 'none', 'win_amd64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ('py37', 'none', 'any'), ('py3', 'none', 'any'), ('py36', 'none', 'any'), ('py35', 'none', 'any'), ('py34', 'none', 'any'), ('py33', 'none', 'any'), ('py32', 'none', 'any'), ('py31', 'none', 'any'), ('py30', 'none', 'any')]

总结

以上所述是小编给大家介绍的Python3.7中安装openCV库的方法,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:https://blog.csdn.net/Toby_Cho/article/details/81001382