无法使用 python 3.8 构建 opencv-python

tud*_*dou 1 opencv python-3.x

操作系统:ubuntu 我可以从命令行安装 opencv-python 。但是,当我尝试安装带有 opencv-python 依赖项的自建包时,它无法构建:

Building wheels for collected packages: opencv-python
  Building wheel for opencv-python (PEP 517): started
  Building wheel for opencv-python (PEP 517): finished with status 'error'
  ERROR: Complete output from command /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp7jntqv2r:
  ERROR: Not searching for unused variables given on the command line.
  CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-install-utbicth7/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
  Not searching for unused variables given on the command line.
  CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-install-utbicth7/opencv-python/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".


-- Trying "Unix Makefiles" generator - failure
  --------------------------------------------------------------------------------
  
  ********************************************************************************
  scikit-build could not get a working generator for your system. Aborting build.
  
  Building Linux wheels for Python 3.6 requires a compiler (e.g gcc).
  It can be installed using debian package manager:
  
    sudo apt-get install build-essential
  
  To build compliant wheels, consider using the manylinux system described in PEP-513.
  Get it with "dockcross/manylinux-x64" docker image:
  
    https://github.com/dockcross/dockcross#readme
  
  For more details, please refer to scikit-build documentation:
  
    http://scikit-build.readthedocs.io/en/latest/generators.html#linux
  
  ********************************************************************************
  ----------------------------------------
  ERROR: Failed building wheel for opencv-python

Run Code Online (Sandbox Code Playgroud)

我怀疑问题出在 scikit-build 上。我检查了 ninja、make/gcc 都可用。我手动设置CMAKE_MAKE_PROGRAM=/usr/bin/make。

但仍然失败并出现同样的错误。我

ray*_*ica 7

您缺少依赖项。请查看您上面提供的错误消息的这一部分:

  Building Linux wheels for Python 3.6 requires a compiler (e.g gcc).
  It can be installed using debian package manager:
  
    sudo apt-get install build-essential
Run Code Online (Sandbox Code Playgroud)

因此,请使用apt-get安装构建包所需的构建工具。