pycharm安装opencv-python报错

通过pycharm中的Terminal窗口安装opencv-python错误如下:

pycharm安装opencv-python报错_第1张图片

上图所示为部分错误,全部错误如下:

  Building wheel for opencv-contrib-python (PEP 517) ... error
  ERROR: Complete output from command 'D:\anzhuanglujing\Anaconda\python.exe' 'D:\anzhuanglujing\Anaconda\lib\site
-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\Administrator\AppData\Local\Temp\tmpjqvqd9_8':
  ERROR: 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/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/build/CMakeFiles/CMakeOutput.log".
  Not searching for unused variables given on the command line.
  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator
  
      Visual Studio 17 2022
  
    could not find any instance of Visual Studio.
  
  
  
  -- Configuring incomplete, errors occurred!
  See also "C:/Users/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/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/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/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/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/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/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/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/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/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/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/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/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/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/Administrator/AppData/Local/Temp/pip-install-bc_r227f/opencv-contrib-python/_cmake_test_compi
le/build/CMakeFiles/CMakeOutput.log".
  
  
  --------------------------------------------------------------------------------
  -- Trying "Ninja (Visual Studio 17 2022 x64 v143)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Ninja (Visual Studio 17 2022 x64 v143)" generator - failure
  --------------------------------------------------------------------------------
  
  
  
  --------------------------------------------------------------------------------
  -- Trying "Visual Studio 17 2022 x64 v143" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Visual Studio 17 2022 x64 v143" generator - failure
  --------------------------------------------------------------------------------
  
  
  
  --------------------------------------------------------------------------------
  -- 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 "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 17 2022 x64 v143)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "NMake Makefiles (Visual Studio 17 2022 x64 v143)" generator - failure
  --------------------------------------------------------------------------------
  
  
  
  --------------------------------------------------------------------------------
  -- Trying "NMake Makefiles (Visual Studio 16 2019 x64 v142)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "NMake Makefiles (Visual Studio 16 2019 x64 v142)" 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 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-contrib-python
  Running setup.py clean for opencv-contrib-python
Failed to build opencv-contrib-python
ERROR: Could not build wheels for opencv-contrib-python which use PEP 517 and cannot be installed directly
 

解决办法:升级pip版本,命令如下:python -m pip install --upgrade pip

升级后显示如下图所示:

pycharm安装opencv-python报错_第2张图片

安装opencv-python,

命令如下:pip install opencv-contrib-python -ihttps://pypi.tuna.tsinghua.edu.cn/simple

安装成功后结果如下图所示:

pycharm安装opencv-python报错_第3张图片

 参考博客:(12条消息) PIP安装OpenCv报错_木子小喵的博客-CSDN博客_pip安装opencv失败

 下方回复

你可能感兴趣的:(大数据)