You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修复pip install nuscenes-devkit中的‘ERROR: Could not build wheels for matplotlib’错误?

解决nuScenes-devkit安装时matplotlib编译wheel失败的问题

问题本质

Could not build wheels for matplotlib报错的核心原因是编译matplotlib二进制包缺少系统级依赖——matplotlib的部分组件需要C++编译工具、图形库(如freetype、png)等支持,这些依赖没装的话,哪怕更新pip或指定版本也没用。

修复步骤

1. 先补全系统依赖

根据你的操作系统执行对应命令:

Debian/Ubuntu 系列 Linux

sudo apt update
sudo apt install build-essential python3-dev libfreetype6-dev libpng-dev libjpeg-dev

CentOS/RHEL 系列 Linux

sudo yum groupinstall "Development Tools"
sudo yum install python3-devel freetype-devel libpng-devel libjpeg-turbo-devel

Windows

  • 安装Visual Studio构建工具,勾选C++开发工具和配套的Windows SDK组件;
  • 或者安装MinGW-w64,把它的bin目录添加到系统环境变量PATH里。

macOS

xcode-select --install
brew install freetype libpng jpeg

2. 重新配置pip并安装matplotlib

先确保pip、setuptools、wheel是最新版:

pip install --upgrade pip setuptools wheel

再安装指定版本的matplotlib:

pip install matplotlib==3.2.1

3. 安装nuScenes-devkit

matplotlib安装成功后,执行:

pip install nuscenes-devkit

如果是用requirements.txt安装:

pip install -r requirements.txt

额外排查建议

  • 确认你在激活的虚拟环境里执行所有命令(如果用了虚拟环境);
  • 检查Python版本是否符合nuScenes要求(官方支持3.6-3.9版本);
  • 若仍失败,可直接下载对应系统和Python版本的matplotlib预编译wheel包,用pip install /path/to/matplotlib.whl手动安装后,再尝试装nuScenes。

内容的提问来源于stack exchange,提问作者khosrow

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 08:26:21