错误:无法为使用 PEP 517 且无法直接安装的 opencv-python 构建轮子

新手上路,请多包涵

我试图在 jetson nano 上的 docker 中安装 OpenCV4。它有jetpack 4.4 s os。 docker 已成功创建并且 Tensorflow 正在运行,但是在使用 pip 安装 OpenCV 时显示 CMake 错误。

 root@5abf405fb92d:~# pip3 install opencv-python
Collecting opencv-python
  Downloading opencv-python-4.4.0.42.tar.gz (88.9 MB)
     |████████████████████████████████| 88.9 MB 2.5 kB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: numpy>=1.13.3 in /usr/local/lib/python3.6/dist-packages (from opencv-python) (1.18.4)
Building wheels for collected packages: opencv-python
  Building wheel for opencv-python (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpqpzwrofy
       cwd: /tmp/pip-install-93nxibky/opencv-python
  Complete output (9 lines):
    File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/site-packages/skbuild/setuptools_wrap.py", line 560, in setup
      cmkr = cmaker.CMaker(cmake_executable)
    File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 95, in __init__
      self.cmake_version = get_cmake_version(self.cmake_executable)
    File "/tmp/pip-build-env-o_hualnr/overlay/lib/python3.6/site-packages/skbuild/cmaker.py", line 82, in get_cmake_version
      "Problem with the CMake installation, aborting build. CMake executable is %s" % cmake_executable)
  Traceback (most recent call last):

  Problem with the CMake installation, aborting build. CMake executable is cmake
  ----------------------------------------
  ERROR: Failed building wheel for opencv-python
Failed to build opencv-python
ERROR: Could not build wheels for opencv-python which use PEP 517 and cannot be installed directly

原文由 Kasi Viswanath 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 2.5k
2 个回答

我有同样的问题,我这样做了,

 pip install --upgrade pip setuptools wheel

然后再次安装opencv,

 pip install opencv-python

这对我有用

原文由 Yohan_Dhananjaya 发布,翻译遵循 CC BY-SA 4.0 许可协议

如果之后

pip install --upgrade pip setuptools wheel

你仍然有同样的错误,

您可以尝试指定要安装的旧版本的 OpenCV。

前任。

 pip3 install opencv-python==3.4.13.47

原文由 willSapgreen 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题