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

搭建深度学习环境:安装scikit-misc包时遇编译错误

解决scikit-misc安装时gfortran编译失败问题

问题背景

在arm64架构macOS的conda环境(py38tor19)中执行pip install scikit-misc时,出现元数据生成失败错误,核心原因是环境内的/Users/wuyang/anaconda3/envs/py38tor19/bin/arm64-apple-darwin20.0.0-gfortran编译器无法正常编译程序,meson构建工具抛出错误。

完整错误日志:

Collecting scikit-misc
Using cached scikit_misc-0.2.0.tar.gz (247 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
+ meson setup /private/var/folders/fz/_9vjnd3108ldp9pp9l66swgr0000gn/T/pip-install-wnjt0p1c/scikit-misc_8b58ae08c95243f1b478e2d54d678191 /private/var/folders/fz/_9vjnd3108ldp9pp9l66swgr0000gn/T/pip-install-wnjt0p1c/scikit-misc_8b58ae08c95243f1b478e2d54d678191/.mesonpy-e6ut0255 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/private/var/folders/fz/_9vjnd3108ldp9pp9l66swgr0000gn/T/pip-install-wnjt0p1c/scikit-misc_8b58ae08c95243f1b478e2d54d678191/.mesonpy-e6ut0255/meson-python-native-file.ini
The Meson build system
Version: 1.6.0
Source dir: /private/var/folders/fz/_9vjnd3108ldp9pp9l66swgr0000gn/T/pip-install-wnjt0p1c/scikit-misc_8b58ae08c95243f1b478e2d54d678191
Build dir: /private/var/folders/fz/_9vjnd3108ldp9pp9l66swgr0000gn/T/pip-install-wnjt0p1c/scikit-misc_8b58ae08c95243f1b478e2d54d678191/.mesonpy-e6ut0255
Build type: native build
Project name: scikit-misc
Project version: 0.2.0
C compiler for the host machine: arm64-apple-darwin20.0.0-clang (clang 14.0.6 "clang version 14.0.6")
C linker for the host machine: arm64-apple-darwin20.0.0-clang ld64 530
Cython compiler for the host machine: cython (cython 3.0.11)
Host machine cpu family: aarch64
Host machine cpu: aarch64

../meson.build:18:0: ERROR: Compiler /Users/wuyang/anaconda3/envs/py38tor19/bin/arm64-apple-darwin20.0.0-gfortran cannot compile programs.

A full log can be found at /private/var/folders/fz/_9vjnd3108ldp9pp9l66swgr0000gn/T/pip-install-wnjt0p1c/scikit-misc_8b58ae08c95243f1b478e2d54d678191/.mesonpy-e6ut0255/meson-logs/meson-log.txt
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

解决方案

方案1:修复conda环境中的gfortran编译器

conda自带的gfortran可能存在适配问题,重新安装适配arm64的版本:

  • 卸载当前gfortran:
    conda uninstall -y gfortran
    
  • 从conda-forge安装适配arm64的gfortran:
    conda install -c conda-forge gfortran
    
  • 验证安装成功:
    gfortran --version
    
    确认输出包含正常的版本信息(如GNU Fortran (Homebrew GCC 13.2.0) 13.2.0)。

方案2:清理缓存后重新用pip安装

修复编译器后,清理pip缓存再尝试安装:

pip cache purge
pip install scikit-misc

方案3:直接使用conda预编译包(推荐)

避免编译环节,直接安装conda-forge提供的预编译scikit-misc包:

conda install -c conda-forge scikit-misc

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 11:26:21