pycocotools安装报错

前言

pycocotools 是一个Python库,用于处理和评估在 Microsoft COCO 数据集上训练的目标检测和分割模型。COCO是一个流行的计算机视觉数据集,包含用于目标检测、实例分割和关键点检测任务的大量图像和注释。
使用 pycocotools 可以帮助机器学习和计算机视觉开发者更方便地处理和评估 COCO 数据集上的模型,从而加速模型的开发和优化。

一,报错信息

Building wheel for pycocotools (PEP 517) … error
ERROR: Command errored out with exit status 1:

error: command ‘gcc’ failed: No such file or directory

ERROR: Failed building wheel for pycocotools

Failed to build pycocotools
ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be installed directly

二,报错原因

缺少gcc

三,解决方法

3.1,对于Ubuntu系统

sudo apt-get install python3-dev  
sudo apt-get install gcc
pip install --upgrade setuptools

3.2,对于Windows系统

方法一

pip install pycocotools-windows

方法二

pip install git+https://github.com/philferriere/cocoapi.git

方法三

pip install git+https://gitee.com/felord/cocoapi.git

方法四(对于我有效)
一定要先安装git和Visual Studio和相应的Build Tools
安装完后还要更新setuptools

pip install --upgrade setuptools
pip install pycocotools -i https://mirrors.aliyun.com/pypi/simple/

猜你喜欢

转载自blog.csdn.net/m0_47026232/article/details/130444906