【发布时间】:2014-05-17 16:04:13
【问题描述】:
我想使用 brew 安装 numpy 的工作版本。 brew install numpy 给出消息:
==> python setup.py build --fcompiler=gnu95 install --prefix=/usr/local/Cellar/numpy/1.8.1
File "/private/tmp/numpy-ncUw/numpy-1.8.1/numpy/distutils/fcompiler/gnu.py", line 197, in get_flags_opt
v = self.get_version()
File "/private/tmp/numpy-ncUw/numpy-1.8.1/numpy/distutils/fcompiler/__init__.py", line 434, in get_version
raise CompilerNotFound()
numpy.distutils.fcompiler.CompilerNotFound
brew doctor 没问题,所以实际上可能是缺少 fortran 编译器问题。试试看:brew install gfortran
Error: No available formula for gfortran
嗯。从 brew GitHub issue tracker 中的 cmets 来看,gfortran 似乎不再在 brew 中。让我们尝试从the project website 下载gfortran 4.9.0 并设置FC=\path\to\gfortran 以便brew 知道使用它
==> 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/numpy/NumPy/1.8.1/numpy-1.8.1.tar.gz
Already downloaded: /Library/Caches/Homebrew/numpy-1.8.1.tar.gz
==> python setup.py build --fcompiler=gnu95 install --prefix=/usr/local/Cellar/numpy/1.8.1
File "/private/tmp/numpy-mrQk/numpy-1.8.1/numpy/distutils/fcompiler/gnu.py", line 197, in get_flags_opt
v = self.get_version()
File "/private/tmp/numpy-mrQk/numpy-1.8.1/numpy/distutils/fcompiler/__init__.py", line 434, in get_version
raise CompilerNotFound()
numpy.distutils.fcompiler.CompilerNotFound
Drat,所以 brew 不想使用非默认的 fortran 编译器。我使用的是 OSX 10.9,默认安装了 llvm,所以要小心添加 gcc 安装。当 llvm 接管时,许多程序必须重新编译,因此(再次)更改默认编译器似乎很危险。
非常欢迎任何有关如何让 brew 完成安装的建议。
【问题讨论】:
标签: python numpy fortran homebrew gfortran