1 问题描述
使用 pip 安装 scipy 包卡在 Preparing metadata:
Collecting scipy==1.12.0 (from -r requirements.txt (line 4))
Downloading https://mirrors.aliyun.com/pypi/packages/30/85/cdbf2c3c460fe5aae812917866392068a88d02f07de0fe31ce738734c477/scipy-1.12.0.tar.gz (56.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.8/56.8 MB 1.8 MB/s eta 0:00:00
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
╰─> [47 lines of output]
+ meson setup C:\Users\amnes\AppData\Local\Temp\pip-install-yvgsksnt\scipy_6f89d867535643ea808cc10786f0396c C:\Users\amnes\AppData\Local\Temp\pip-install-yvgsksnt\scipy_6f89d867535643ea808cc10786f0396c\.mesonpy-05bb2c13 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\amnes\AppData\Local\Temp\pip-install-yvgsksnt\scipy_6f89d867535643ea808cc10786f0396c\.mesonpy-05bb2c13\meson-python-native-file.ini
The Meson build system
Version: 1.8.2
Source dir: C:\Users\amnes\AppData\Local\Temp\pip-install-yvgsksnt\scipy_6f89d867535643ea808cc10786f0396c
Build dir: C:\Users\amnes\AppData\Local\Temp\pip-install-yvgsksnt\scipy_6f89d867535643ea808cc10786f0396c\.mesonpy-05bb2c13
Build type: native build
Activating VS 17.14.7
Project name: scipy
Project version: 1.12.0
C compiler for the host machine: cl (msvc 19.44.35211 "用于 x64 的 Microsoft (R) C/C++ 优化编译 器 19.44.35211 版")
C linker for the host machine: link link 14.44.35211.0
C++ compiler for the host machine: cl (msvc 19.44.35211 "用于 x64 的 Microsoft (R) C/C++ 优化编 译器 19.44.35211 版")
C++ linker for the host machine: link link 14.44.35211.0
Cython compiler for the host machine: cython (cython 3.0.12)
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python found: YES (D:\Documents\Code\Python\UAVsPlan\uva_plan_venv\Scripts\python.exe)
Run-time dependency python found: YES 3.13
Program cython found: YES (C:\Users\amnes\AppData\Local\Temp\pip-build-env-qmn8hja9\overlay\Scripts\cython.EXE)
Compiler for C supports arguments -Wno-unused-but-set-variable: NO
Compiler for C supports arguments -Wno-unused-function: NO
Compiler for C supports arguments -Wno-conversion: NO
Compiler for C supports arguments -Wno-misleading-indentation: NO
Library m found: NO
..\meson.build:80:0: ERROR: Unknown compiler(s): [['ifort'], ['gfortran'], ['flang-new'], ['flang'], ['pgfortran'], ['g95']]
The following exception(s) were encountered:
Running `ifort --help` gave "[WinError 2] 系统找不到指定的文件。"
Running `ifort --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `ifort -V` gave "[WinError 2] 系统找不到指定的文件。"
Running `gfortran --help` gave "[WinError 2] 系统找不到指定的文件。"
Running `gfortran --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `gfortran -V` gave "[WinError 2] 系统找不到指定的文件。"
Running `flang-new --help` gave "[WinError 2] 系统找不到指定的文件。"
Running `flang-new --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `flang-new -V` gave "[WinError 2] 系统找不到指定的文件。"
Running `flang --help` gave "[WinError 2] 系统找不到指定的文件。"
Running `flang --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `flang -V` gave "[WinError 2] 系统找不到指定的文件。"
Running `pgfortran --help` gave "[WinError 2] 系统找不到指定的文件。"
Running `pgfortran --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `pgfortran -V` gave "[WinError 2] 系统找不到指定的文件。"
Running `g95 --help` gave "[WinError 2] 系统找不到指定的文件。"
Running `g95 --version` gave "[WinError 2] 系统找不到指定的文件。"
Running `g95 -V` gave "[WinError 2] 系统找不到指定的文件。"
A full log can be found at C:\Users\amnes\AppData\Local\Temp\pip-install-yvgsksnt\scipy_6f89d867535643ea808cc10786f0396c\.mesonpy-05bb2c13\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.
2 问题分析
终端日志显示安装scipy==1.12.0时因缺少Fortran编译器(如ifort、gfortran)导致编译失败。scipy作为依赖Fortran的科学计算库,需要额外的编译工具支持。
3 解决方法
通过 Visual Studio Build Tools 安装 Intel Fortran 编译器
3.1 物料准备


3.2 安装



5608

被折叠的 条评论
为什么被折叠?



