当前位置:   article > 正文

解决:ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-base_which is required to install pyproject.toml-based

which is required to install pyproject.toml-based projects

解决:ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects

背景

在搭建环境,通过python安装opencv时,报错:
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

报错问题

  Please check the install target is valid and see CMake's output for more information.
  ----------------------------------------
  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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

截图如下:

在这里插入图片描述

报错翻译

主要报错信息内容翻译如下所示:

  Please check the install target is valid and see CMake's output for more information.
  ----------------------------------------
  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

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

翻译:

请检查安装目标是否有效,并查看 CMake 的输出以获取更多信息。
  ----------------------------------------
  错误:opencv-python 的构建轮失败
无法构建 opencv-python
错误:无法为 opencv-python 构建轮子,这是安装基于 pyproject.toml 的项目所必需的

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

报错原因

经过查阅资料,发现是版本兼容性问题。当使用pip install opencv-python命令安装的是最新版本,当前python版本不支持。需要安装当前版本python支持的opencv-python版本。

附:各版本Opencv的对应的各版本Python安装包:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
在这里插入图片描述

小伙伴们按下面的解决方法即可解决!!!

解决方法

要解决这个错误,需要安装当前版本python支持的opencv-python版本。如opencv-python==4.3.0.38。

命令如下:

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

截图如下:

在这里插入图片描述

附:



今天的分享就到此结束了

欢迎点赞评论关注三连

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/84709
推荐阅读
相关标签
  

闽ICP备14008679号