SoFunction
Updated on 2025-03-02

How to install openCV library in Python 3.7

1. First, it is not feasible to enter pip3 install openCV directly in cmd, that is, you need to download the installation package yourself and install it locally.

Library Download Address/~gohlke/pythonlibs/#opencv

3.opencv_python‑3.4.2‑cp37‑cp37m‑win_amd64.whl (cp37 refers to the python version, win_amd64 refers to python being 64-bit. It is also possible that someone has a 64-bit system that has 32-bit Python installed, and at this time, you need to install the win32 version)

4. After the download is completed, enter pip3 install file path\opencv_python‑3.4.2‑cp37‑cp37m‑win_amd64.whl in cmd

5. If an error occurs opencv_python‑3.4.2‑cp37‑cp37m‑win_amd64.whl is not a supported wheel on this platform. In cmd, you can query the version that your python can support through the following code, and then select the version that suits you.

#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')]

Summarize

The above is the method of installing the openCV library in Python 3.7 introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!