在OSX上使用brew安装scipy时出错

1 投票
2 回答
2019 浏览
提问于 2025-04-18 11:23

我在我的OSX 10.9电脑上用brew安装scipy,但安装总是失败:

administrators-iMac-3:sourcefind_python bill$ brew install scipy --default-fortran-flags
==> Using Homebrew-provided fortran compiler.
This may be changed by setting the FC environment variable.
==> Building with an alternative Fortran compiler
This is unsupported.
Warning: No Fortran optimization information was provided.  You may want to consider
setting FCFLAGS and FFLAGS or pass the `--default-fortran-flags` option to
`brew install` if your compiler is compatible with GCC.

If you like the default optimization level of your compiler, ignore this
warning.
==> Downloading https://downloads.sourceforge.net/project/scipy/scipy/0.13.3/scipy-0.13.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/scipy-0.13.3.tar.gz
==> python setup.py build --fcompiler=gnu95 install --prefix=/usr/local/Cellar/scipy/0.13.3_1
  Referenced from: /usr/local/Cellar/gcc/4.8.3_1/libexec/gcc/x86_64-apple-darwin13.2.0/4.8.3/f951
  Reason: image not found
gfortran: internal compiler error: Trace/BPT trap: 5 (program f951)
sh: line 1:  9597 Abort trap: 6           /usr/local/bin/gfortran -Wall -ffixed-form -fno-second-underscore -ff2c -O3 -funroll-loops -I/usr/local/lib/python2.7/site-packages/numpy/core/include -c -c scipy/fftpack/src/dfftpack/dcosqb.f -o build/temp.macosx-10.9-x86_64-2.7/scipy/fftpack/src/dfftpack/dcosqb.o
error: Command "/usr/local/bin/gfortran -Wall -ffixed-form -fno-second-underscore -ff2c -O3 -funroll-loops -I/usr/local/lib/python2.7/site-packages/numpy/core/include -c -c scipy/fftpack/src/dfftpack/dcosqb.f -o build/temp.macosx-10.9-x86_64-2.7/scipy/fftpack/src/dfftpack/dcosqb.o" failed with exit status 134

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/samueljohn/homebrew-python/issues

我已经安装了gcc,应该里面有gfortran:

administrators-iMac-3:sourcefind_python bill$ brew install gfortran
Error: No available formula for gfortran
GNU Fortran is now provided as part of GCC, and can be installed with:
  brew install gcc

administrators-iMac-3:sourcefind_python bill$ brew install gcc
Warning: gcc-4.8.3_1 already installed

应该在这里:

administrators-iMac-3:sourcefind_python bill$ gfortran
gfortran: fatal error: no input files
compilation terminated.

2 个回答

0

看起来它在使用Fortran编译器时遇到了问题。当我在Mac OSX上用Homebrew安装SciPy时,通常还会安装gfortran来编译SciPy中的Fortran文件。

你可以试试这样做:

brew install gfortran

然后再试一次。

0

要解决这个问题,你需要使用另一个版本的 gfortran。详细的说明可以在 这里找到。

你也可以尝试使用 这里 提供的 .dmg 安装程序来进行安装。

撰写回答