E:\bishe\python3.6django>pip3 install opencv-python
Collecting opencv-python
Using cached opencv-python-4.7.0.72.tar.gz (91.1 MB)
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing metadata (pyproject.toml) … done
Requirement already satisfied: numpy>=1.13.3 in c:\users\11097\appdata\local\programs\python\python36\lib\site-packages (from opencv-python) (1.19.5)
Building wheels for collected packages: opencv-python
Building wheel for opencv-python (pyproject.toml) … error
ERROR: Command errored out with exit status 1:
command: ‘c:\users\11097\appdata\local\programs\python\python36\python.exe’ ‘c:\users\11097\appdata\local\programs\python\python36\lib\site-packages\pip_vendor\pep517\in_process_in_process.py’ bui
ld_wheel ‘C:\Users\11097\AppData\Local\Temp\tmpsy8crm_r’
cwd: C:\Users\11097\AppData\Local\Temp\pip-install-9xjpj_wi\opencv-python_0baefd638133466cac896dddad562425
scikit-build could not get a working generator for your system. Aborting build.
Building windows wheels for Python 3.6 requires Microsoft Visual Studio 2022.
Get it with “Visual Studio 2017”:
https://visualstudio.microsoft.com/vs/
Or with “Visual Studio 2019”:
https://visualstudio.microsoft.com/vs/
Or with “Visual Studio 2022”:
https://visualstudio.microsoft.com/vs/
ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects
比如我的版本是python3.6,就改成pip install opencv-python==3.2.0.7即可。