安装scipy找不到fortran mac

时间:2015-08-14 00:16:35

标签: python macos scipy

我在安装scipy时遇到了很大麻烦。

当我跑:     pip install scipy

我明白了:

Requirement already satisfied (use --upgrade to upgrade): scipy in 
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

但是当我在python中导入scipy时,我得到了名为scipy error的no模块。

当我尝试通过easy_install scipy时,它开始下载然后给我:

error: Setup script exited with error: library dfftpack has Fortran sources but no Fortran compiler found

当我尝试通过brew安装gfortran时,我得到:brew gfortran

Error: No available formula for gfortran 
GNU Fortran is now provided as part of GCC, and can be installed with:
brew install gcc

但是当我尝试这样做时,我得到了:

(py)Shopkicks-MacBook-Air-12:shopkick markthornburg$ brew install gcc
Warning: gcc-5.2.0 already installed, it's just not linked

我做错了什么?

1 个答案:

答案 0 :(得分:1)

您是否尝试过手动将gfortran链接到/usr/local/bin,例如:

ln -s /usr/local/Cellar/gfortran/4.8.2/bin/gfortran /usr/local/bin/

根据安装的版本,您可能需要将路径替换为gfortran。

您可能还想设置:

export LD_LIBRARY_PATH=/usr/local/Cellar/gfortran/4.8.2/gfortran/lib:$LD_LIBRARY_PATH
export CPLUS_INCLUDE_PATH=/usr/local/Cellar/gfortran/4.8.2/gfortran/include/c++/4.8.2:$CPLUS_INCLUDE_PATH

同样,这些路径可能需要在您的系统上进行更改(取决于版本)