您好,欢迎来到叨叨游戏网。
搜索
您的当前位置:首页解决opencv安装报错的问题

解决opencv安装报错的问题

来源:叨叨游戏网
  ERROR: Command errored out with exit status 1:
   command: 'd:\anaconda3\envs\env1\python.exe' 'd:\anaconda3\envs\env1\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' build_wheel 'C:\Users\14982\AppData\Local\Temp\tmpi6hlxppw'
       cwd: C:\Users\14982\AppData\Local\Temp\pip-install-m7mce79y\opencv-python_3e6fb3d7d2c9480e8cb90dd51b63fca5
  Complete output (395 lines):


  --------------------------------------------------------------------------------
  -- Trying 'Ninja (Visual Studio 17 2022 x v143)' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Ninja

    does not support platform specification, but platform

      x

    was specified.


  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'Ninja (Visual Studio 17 2022 x v143)' generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying 'Visual Studio 17 2022 x v143' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Visual Studio 17 2022

    could not find any instance of Visual Studio.



  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'Visual Studio 17 2022 x v143' generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying 'Ninja (Visual Studio 16 2019 x v142)' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Ninja

    does not support platform specification, but platform

      x

    was specified.


  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'Ninja (Visual Studio 16 2019 x v142)' generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying 'Visual Studio 16 2019 x v142' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Visual Studio 16 2019

    could not find any instance of Visual Studio.



  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'Visual Studio 16 2019 x v142' generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying 'Ninja (Visual Studio 15 2017 x v141)' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Ninja

    does not support platform specification, but platform

      x

    was specified.


  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'Ninja (Visual Studio 15 2017 x v141)' generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying 'Visual Studio 15 2017 x v141' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Visual Studio 15 2017

    could not find any instance of Visual Studio.



  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'Visual Studio 15 2017 x v141' generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying 'NMake Makefiles (Visual Studio 17 2022 x v143)' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      NMake Makefiles

    does not support platform specification, but platform

      x

    was specified.


  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'NMake Makefiles (Visual Studio 17 2022 x v143)' generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying 'NMake Makefiles (Visual Studio 16 2019 x v142)' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      NMake Makefiles

    does not support platform specification, but platform

      x

    was specified.


  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'NMake Makefiles (Visual Studio 16 2019 x v142)' generator - failure
  --------------------------------------------------------------------------------



  --------------------------------------------------------------------------------
  -- Trying 'NMake Makefiles (Visual Studio 15 2017 x v141)' generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  Not searching for unused variables given on the command line.
  CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
    Compatibility with CMake < 3.5 will be removed from a future version of
    CMake.

    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.


  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      NMake Makefiles

    does not support platform specification, but platform

      x

    was specified.


  -- Configuring incomplete, errors occurred!
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying 'NMake Makefiles (Visual Studio 15 2017 x v141)' generator - failure
  --------------------------------------------------------------------------------

  ********************************************************************************
  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

在安装过程中出现了这样的报错,通过一下方法解决:

step1:检查一下python版本,版本过低可能导致安转不匹配的问题出现。这一步一定要进入安装的虚拟环境查看,可能会出现虚拟环境中的Python版本不一样的现象。

python --version
Python 3.6.13 :: Anaconda, Inc.

由于我的虚拟环境版本比较低,所以我们选择合适的cv就可以了。

pip install -i https://pypi.douban.com/simple/ pip install opencv-python==4.3.0.38

但是之后出现一下报错:

Looking in indexes: https://pypi.douban.com/simple/
Requirement already satisfied: pip in d:\anaconda3\envs\env1\lib\site-packages (21.3.1)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /simple/install/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /simple/install/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /simple/install/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /simple/install/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /simple/install/
ERROR: Could not find a version that satisfies the requirement install (from versions: none)
ERROR: No matching distribution found for install

更新了一下pip:

pip install --upgrade pip

还是不行,换了一条语句执行:pip install opencv-python==4.3.0.38

pip install opencv-python==4.3.0.38

顺利解决。

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- gamedaodao.net 版权所有 湘ICP备2024080961号-6

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务