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

Python 3.11 X86环境安装matplotlib失败求助(勿用conda)

问题描述

Python 3.11 X86环境执行pip install matplotlib时,因无法下载freetype依赖包导致编译失败,报错信息如下:

error: Failed to download any of the following: ['https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz',
'https://download.savannah.gnu.org/releases/freetype/freetype-2.6.1.tar.gz',
'https://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.6.1.tar.gz'].
Please download one of these urls and extract it into 'build/' at the top-level of the source repository.
[end of output]

ERROR: Failed building wheel for matplotlib
ERROR: Could not build wheels for matplotlib, which is required to install pyproject.toml-based projects

注:此错误源自子进程,非pip本身问题,且禁用conda解决。


解决方法

方法一:手动提供freetype依赖完成编译

  • 从给出的三个地址中任选一个下载freetype-2.6.1.tar.gz压缩包
  • 在执行pip install matplotlib的当前目录下,创建名为build的文件夹
  • 将下载的压缩包解压,把完整的freetype-2.6.1文件夹放入build目录
  • 重新执行pip install matplotlib,pip会自动调用本地的freetype包完成编译

方法二:安装预编译wheel包(推荐,跳过源码编译)

  • 先升级pip到最新版本:
    python -m pip install --upgrade pip
    
  • 执行命令强制安装预编译包,避免源码编译环节:
    pip install matplotlib --only-binary :all:
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 14:25:08