简体   繁体   English

无法使用 python 3.8 构建 opencv-python

[英]Unable to build opencv-python with python 3.8

OS:ubuntu I am able to install opencv-python from the command line.操作系统:ubuntu 我可以从命令行安装 opencv-python。 However,when I tried to install my self-built package with opencv-python dependencies, it failed to biuld:但是,当我尝试使用 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

I suspect issue is with scikit-build.我怀疑问题出在 scikit-build 上。 I checked I have ninja, make/gcc all available.我检查过我有 ninja,make/gcc 都可用。 I set manually CMAKE_MAKE_PROGRAM=/usr/bin/make.我手动设置了 CMAKE_MAKE_PROGRAM=/usr/bin/make。

But still failed with same error.但仍然以同样的错误失败。 I一世

You are missing dependencies.您缺少依赖项。 Please see this part of the error message you have provided above:请参阅您在上面提供的错误消息的这一部分:

  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

Therefore, please use apt-get to install the build tools required to build your package.因此,请使用apt-get安装构建包所需的构建工具。

在安装 opencv-python 之前运行pip3 install -U pip

Finally figured out, when I installed locally I had a requirements with version 4.1.x and no issues.终于想通了,当我在本地安装时,我对版本 4.1.x 有要求并且没有问题。 When I install with the dependencies, it fetches the latest version 4.4 and the issue is that 1) pip version is 19.1 and2) since 4.3 opencv, the wheels has been replaced.当我安装依赖项时,它获取最新版本 4.4,问题是 1) pip 版本是 19.1 和 2) 自 4.3 opencv 以来,轮子已被更换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM