安装pycocotools时遇到ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be instal

操作系统:ubuntu18.04.6

最近在安装MMdetection3d时,其中一步需要安装pycocotools,但是直接采用

pip install pycocotools

进行安装时,我遇到了两个问题:

1. 安装速度慢

2. 遇到了报错

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

安装pycocotools困扰了3个整天的时间,因此我整理了博客,希望能够帮助到大家,也作为我以后需要的话,可以快捷地找到解决方法,

针对下载速度慢的问题,我们可以采用国内镜像进行下载,我一般习惯于采用清华镜像,运行

pip install pycocotools -i https://pypi.tuna.tsinghua.edu.cn/simple

即可采用清华镜像进行下载,下载速度瞬间快了很多~

针对报错

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

这一问题,网上搜了很多方法都没有解决我的问题,最后我发现,安装gcc和g++可以解决这一问题。因为我是新配置的虚拟机,所以没有gcc和g++,而pycocotools的安装需要基于gcc和g++才可以运行

解决方法:安装gcc和g++

首先更新包列表,运行

sudo apt update

之后安装build-essential软件包

sudo apt install build-essential

该命令将安装包括gcc,g ++在内的一些包

一般来说,到这一步就可以解决了,但是我还遇到了

Ubantu18.04.6:依赖: g++-7 (>= 7.4.0-1~) 但是它将不会被安装

这样一个问题,后来我参考了这篇博文之后得到了解决     参考

但是需要注意的是,根据这篇文章的评论区,这种方法会降低一些软件的依赖,可能会造成一些危险的后果,所以各位慎用,我是实在没有办法了,所以尝试了这样的方法,最后问题得到了解决。

来源:和自己对话的兔子

物联沃分享整理
物联沃-IOTWORD物联网 » 安装pycocotools时遇到ERROR: Could not build wheels for pycocotools which use PEP 517 and cannot be instal

发表评论