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

解决:ERROR: Could not build wheels for opencv-python, 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

截图如下:

解决:ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-base_第1张图片

报错翻译

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

  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

翻译:

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

报错原因

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

附:各版本Opencv的对应的各版本Python安装包:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv
解决:ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-base_第2张图片

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

解决方法

要解决这个错误,需要安装当前版本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

截图如下:

解决:ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-base_第3张图片

附:



今天的分享就到此结束了

欢迎点赞评论关注三连

在这里插入图片描述

你可能感兴趣的:(#,Python,Bug,opencv,python,机器学习,深度学习,人工智能)