anaconda安裝opencv-python報錯
1.執(zhí)行情況如下
C:\Users\EDY>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting opencv-python
? Downloading https://pypi.tuna.tsinghua.edu.cn/packages/c4/e2/27a153e27b98410cf5a871096a8baf98dd642e6685d3ebe7abd9edc8d51a/opencv-python-4.5.5.62.tar.gz (89.9MB)
? ? 100% |████████████████████████████████| 89.9MB 416kB/s
? Installing build dependencies ... done
? Getting requirements to build wheel ... done
? ? Preparing wheel metadata ... done
Collecting numpy>=1.14.5; python_version >= "3.7" (from opencv-python)
? Downloading https://pypi.tuna.tsinghua.edu.cn/packages/22/a3/3a5469ebaca59100e50b4300dd011eed943f2aad7c6a80a07966b985e2c6/numpy-1.21.5-cp37-cp37m-win_amd64.whl (14.0MB)
? ? 100% |████████████████████████████████| 14.0MB 2.5MB/s
Building wheels for collected packages: opencv-python
? Building wheel for opencv-python (PEP 517) ... error
? Complete output from command c:\users\edy\appdata\local\programs\python\python37\python.exe c:\users\edy\appdata\local\programs\python\python37\lib\site-packages\pip\_vendor\pep517\_in_process.py build_wheel C:\Users\EDY\AppData\Local\Temp\tmpccu9cj3w:
? Not searching for unused variables given on the command line.
? CMake Error at CMakeLists.txt:2 (PROJECT):
? ? Generator
? ? ? Ninja
? ? does not support platform specification, but platform
? ? ? x64
? ? was specified.
? -- Configuring incomplete, errors occurred!
? See also "C:/Users/EDY/AppData/Local/Temp/pip-install-hk4cvgjf/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
? Not searching for unused variables given on the command line.
? CMake Error at CMakeLists.txt:2 (PROJECT):
? ? Generator
? ? ? Visual Studio 16 2019
? ? could not find any instance of Visual Studio.
? -- Configuring incomplete, errors occurred!
? See also "C:/Users/EDY/AppData/Local/Temp/pip-install-hk4cvgjf/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
? Not searching for unused variables given on the command line.
? CMake Error at CMakeLists.txt:2 (PROJECT):
? ? Generator
? ? ? NMake Makefiles
? ? does not support platform specification, but platform
? ? ? x64
? ? was specified.
? -- Configuring incomplete, errors occurred!
? See also "C:/Users/EDY/AppData/Local/Temp/pip-install-hk4cvgjf/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
? Not searching for unused variables given on the command line.
? CMake Error at CMakeLists.txt:2 (PROJECT):
? ? Generator
? ? ? Ninja
? ? does not support platform specification, but platform
? ? ? x64
? ? was specified.
? -- Configuring incomplete, errors occurred!
? See also "C:/Users/EDY/AppData/Local/Temp/pip-install-hk4cvgjf/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
? Not searching for unused variables given on the command line.
? CMake Error at CMakeLists.txt:2 (PROJECT):
? ? Generator
? ? ? Visual Studio 15 2017
? ? could not find any instance of Visual Studio.
? -- Configuring incomplete, errors occurred!
? See also "C:/Users/EDY/AppData/Local/Temp/pip-install-hk4cvgjf/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
? Not searching for unused variables given on the command line.
? CMake Error at CMakeLists.txt:2 (PROJECT):
? ? Generator
? ? ? NMake Makefiles
? ? does not support platform specification, but platform
? ? ? x64
? ? was specified.
? -- Configuring incomplete, errors occurred!
? See also "C:/Users/EDY/AppData/Local/Temp/pip-install-hk4cvgjf/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
? --------------------------------------------------------------------------------
? -- Trying "Ninja (Visual Studio 16 2019 x64 v142)" generator
? --------------------------------
? ---------------------------
? ----------------------
? -----------------
? ------------
? -------
? --
? --
? -------
? ------------
? -----------------
? ----------------------
? ---------------------------
? --------------------------------
? -- Trying "Ninja (Visual Studio 16 2019 x64 v142)" generator - failure
? --------------------------------------------------------------------------------
? --------------------------------------------------------------------------------
? -- Trying "Visual Studio 16 2019 x64 v142" generator
? --------------------------------
? ---------------------------
? ----------------------
? -----------------
? ------------
? -------
? --
? --
? -------
? ------------
? -----------------
? ----------------------
? ---------------------------
? --------------------------------
? -- Trying "Visual Studio 16 2019 x64 v142" generator - failure
? --------------------------------------------------------------------------------
? --------------------------------------------------------------------------------
? -- Trying "NMake Makefiles (Visual Studio 16 2019 x64 v142)" generator
? --------------------------------
? ---------------------------
? ----------------------
? -----------------
? ------------
? -------
? --
? --
? -------
? ------------
? -----------------
? ----------------------
? ---------------------------
? --------------------------------
? -- Trying "NMake Makefiles (Visual Studio 16 2019 x64 v142)" generator - failure
? --------------------------------------------------------------------------------
? --------------------------------------------------------------------------------
? -- Trying "Ninja (Visual Studio 15 2017 x64 v141)" generator
? --------------------------------
? ---------------------------
? ----------------------
? -----------------
? ------------
? -------
? --
? --
? -------
? ------------
? -----------------
? ----------------------
? ---------------------------
? --------------------------------
? -- Trying "Ninja (Visual Studio 15 2017 x64 v141)" generator - failure
? --------------------------------------------------------------------------------
? --------------------------------------------------------------------------------
? -- Trying "Visual Studio 15 2017 x64 v141" generator
? --------------------------------
? ---------------------------
? ----------------------
? -----------------
? ------------
? -------
? --
? --
? -------
? ------------
? -----------------
? ----------------------
? ---------------------------
? --------------------------------
? -- Trying "Visual Studio 15 2017 x64 v141" generator - failure
? --------------------------------------------------------------------------------
? --------------------------------------------------------------------------------
? -- Trying "NMake Makefiles (Visual Studio 15 2017 x64 v141)" generator
? --------------------------------
? ---------------------------
? ----------------------
? -----------------
? ------------
? -------
? --
? --
? -------
? ------------
? -----------------
? ----------------------
? ---------------------------
? --------------------------------
? -- Trying "NMake Makefiles (Visual Studio 15 2017 x64 v141)" generator - failure
? --------------------------------------------------------------------------------
? ********************************************************************************
? scikit-build could not get a working generator for your system. Aborting build.
? Building windows wheels for Python 3.7 requires Microsoft Visual Studio 2019.
? Get it with "Visual Studio 2017":
? ? https://visualstudio.microsoft.com/vs/
? Or with "Visual Studio 2019":
? ? https://visualstudio.microsoft.com/vs/
? ********************************************************************************
? ----------------------------------------
? Failed building wheel for opencv-python
? Running setup.py clean for opencv-python
Failed to build opencv-python
Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly
You are using pip version 19.0.3, however version 21.3.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
————————————————
2.解決方法
取消anaconda使用的opencv-python包的想法
使用原生python,也就是官網(wǎng)上下載的純凈版本下載,執(zhí)行pip指令,執(zhí)行無誤,下載成功