python - mac安装scipy找不到fortran

标签 python macos scipy

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

当我运行时: pip 安装 scipy

我得到:

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

但是,当我在 python 中导入 scipy 时,我收到 no module called scipy 错误。

当我尝试通过 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

我做错了什么?

最佳答案

您是否尝试过手动将 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

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

关于python - mac安装scipy找不到fortran,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32000459/

相关文章:

Python 与统计 : fitting to mixed distribution?

python - 动画+在矩阵之间平滑插值

python - 以相同方式处理列表和字典 - 默认情况下

python - 用python读取json字符串的特定部分

mac 上大文件的 java.io.RandomAccessFile 无效参数

python - `numpy.diff` 和 `scipy.fftpack.diff` 在微分时给出不同的结果

python - 逐行打印变量,前面有字符串 Python 2.7

python - “合并”列表中元素的 2 个数据框?

c# - 构建 monobjc Native App 时出现 Xbuild/Mono 错误

objective-c - (Objective-c/Mac OSX) 如何在 Mac OSX 上区分托管 AD 用户(AD 用户创建移动卡)和本地用户