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

安装Pillow、Seaborn时出现Getting requirements to build wheel错误的修复

解决安装Pillow/Seaborn时的SciPy构建wheel错误(缺失Fortran编译器)

错误核心原因:Seaborn依赖SciPy,而编译SciPy的wheel需要Fortran编译器(如gfortran),系统未安装导致Meson构建失败。以下是不同操作系统的解决方法:

Windows系统

  • 方案1:直接安装预编译的SciPy包,避免本地编译
    pip install scipy --only-binary :all:
    pip install pillow seaborn
    
  • 方案2:安装Fortran编译器
    1. 下载安装MinGW-w64,确保勾选gfortran组件
    2. 将MinGW的bin目录(例如C:\MinGW\bin)添加到系统环境变量PATH中
    3. 重新执行安装命令:pip install pillow seaborn

macOS系统

  1. 安装Xcode命令行工具:
    xcode-select --install
    
  2. 通过Homebrew安装gfortran(包含在gcc包中):
    brew install gcc
    
  3. 执行安装命令:
    pip install pillow seaborn
    

Linux系统

Debian/Ubuntu系列

  1. 安装编译器及构建依赖:
    sudo apt update && sudo apt install gfortran gcc python3-dev
    
  2. 执行安装命令:
    pip install pillow seaborn
    

RHEL/CentOS/Fedora系列

  1. 安装编译器及构建依赖:
    # Fedora用dnf,CentOS用yum
    sudo dnf install gcc-gfortran gcc python3-devel
    
  2. 执行安装命令:
    pip install pillow seaborn
    

替代方案:使用Conda管理环境

如果不想手动处理编译器,可通过Conda自动管理依赖:

  1. 创建并激活Conda环境:
    conda create -n my_env python=3.10  # 可替换为你需要的Python版本
    conda activate my_env
    
  2. 直接安装所需包:
    conda install pillow seaborn
    

内容的提问来源于stack exchange,提问作者田丰尧

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.23 12:24:20