Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

当出现此错误时,一般通过直接搜索该错误,其他指南给出的解决办法不一定适用于自己的情况。需要根据报错内容中具体的error找到解决方案。

个人报错情况如下

Building wheels for collected packages: pycocotools
  Building wheel for pycocotools (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pycocotools (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-38
      creating build\lib.win-amd64-cpython-38\pycocotools
      copying pycocotools\coco.py -> build\lib.win-amd64-cpython-38\pycocotools
      copying pycocotools\cocoeval.py -> build\lib.win-amd64-cpython-38\pycocotools
      copying pycocotools\mask.py -> build\lib.win-amd64-cpython-38\pycocotools
      copying pycocotools\__init__.py -> build\lib.win-amd64-cpython-38\pycocotools
      running build_ext
      cythoning pycocotools/_mask.pyx to pycocotools\_mask.c
      building 'pycocotools._mask' extension
      C:\Users\hp\AppData\Local\Temp\pip-build-env-jupdccjk\overlay\Lib\site-packages\Cython\Compiler\Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\hp\AppData\Local\Temp\pip-install-d99qvim5\pycocotools_fb88fac654854a0e97575930567f7c48\pycocotools\_mask.pyx
        tree = Parsing.p_module(s, pxd, full_module_name)
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pycocotools
Failed to build pycocotools
ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects

 根本错误在于Microsoft Visual C++ 14.0 or greater is required.

解决方法

重新安装c++的各个版本没有用,即便我的电脑上有了最新版还是会报错。

所以最终安装了visual studio c++的生成工具(不用安装全部的vs c++)。

Could not build wheels for pycocotools, which is required to install pyproject.toml-based projects_第1张图片

 

你可能感兴趣的:(python,深度学习,目标检测)