安装pycocotools报错: Could not build wheels for pycocotools which use PEP 517 and cannot be installed

一、报错bug

在ubuntu系统的anaconda虚拟环境中pip安装pycocotools可能会出现如下报错:

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

二、报错原因

1,缺少gcc,g++等一些依赖包;
2,python版本问题。

三,解决方法

1,安装缺少的gcc,g++等依赖包

apt-get update
apt-get install build-essential # 安装包括gcc,g++在内的依赖包

2,更换python版本
为了防止更换python版本破坏当前conda虚拟环境,建议重新创建一个新的虚拟环境。

# 假设原先python版本为3.7,要更换为3.8,就重新创建一个python3.8的虚拟环境
conda create --name python38 python=3.8

注:有任何问题欢迎评论区交流讨论!

你可能感兴趣的:(Bug,python,ubuntu,linux,人工智能)