我想使用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中的评论,看起来gfortran不再是酿造品。让我们尝试从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编译器。我默认安装了llvm的OSX 10.9,所以对添加gcc安装很谨慎。当llvm接手时,许多程序必须重新编译,因此更改默认编译器(再次)似乎很危险。
非常欢迎任何关于如何酿造以完成安装的建议。
答案 0 :(得分:9)
brew install gcc
Numpy安装现在运行正常。