2015-04-12 80 views
25

我已閱讀並按照this answer安裝scipy/numpy/theano。但是,在brew安裝gcc之後,它仍然失敗了Fortran編譯器缺少的錯誤。雖然HomeBrew安裝了gcc-4.8,但它沒有安裝任何gfortran或g95命令。我想gfortran可能只是一個gcc的synonymy,然後創建一個符號鏈接仍然無法安裝scipy,因爲在Mac OS X上安裝gcc後缺少fortran編譯器

$ cd /usr/local/bin 
$ ln -s gcc-4.8 gfortran 
$ pip install scipy 

然後檢測gfortran命令,但仍抱怨沒有Fortran編譯

customize Gnu95FCompiler 
Found executable /usr/local/bin/gfortran 
customize NAGFCompiler 
Could not locate executable f95 
customize AbsoftFCompiler 
Could not locate executable f90 
Could not locate executable f77 
customize IBMFCompiler 
Could not locate executable xlf90 
Could not locate executable xlf 
customize IntelFCompiler 
Could not locate executable ifort 
Could not locate executable ifc 
customize GnuFCompiler 
Could not locate executable g77 
customize G95FCompiler 
Could not locate executable g95 
customize PGroupFCompiler 
Could not locate executable pgfortran 
don't know how to compile Fortran code on platform 'posix' 
building 'dfftpack' library 
error: library dfftpack has Fortran sources but no Fortran compiler found 

還有什麼應該怎麼辦?

+0

你真的想編譯'scipy'或正在使用預編譯的版本附帶'anaconda'一個選擇? – cel

+2

gfortran命令本身就像gcc那樣調用一個常見的東西,但是之後它會調用Fortran前端,並且必須安裝它。符號鏈接gfortran→gcc是不夠的。 –

+0

你做過'brew install gcc'嗎? http://stackoverflow.com/questions/26919450/can-not-install-gfortran-via-homebrew –

回答

33

通過升級pip修復,即使我剛剛在同一天重新安裝我的pip/virtualenv。

(mypy)MAC0227: $ pip install --upgrade pip 
... 
(mypy)MAC0227: $ pip install theano 
/Users/me/.virtualenvs/mypy/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. 
    InsecurePlatformWarning 
Requirement already satisfied (use --upgrade to upgrade): theano in /Users/me/.virtualenvs/mypy/lib/python2.7/site-packages 
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.2 in /Users/me/.virtualenvs/mypy/lib/python2.7/site-packages (from theano) 
Collecting scipy>=0.11 (from theano) 
/Users/me/.virtualenvs/mypy/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. 
    InsecurePlatformWarning 
    Downloading scipy-0.15.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (19.8MB) 
    100% |████████████████████████████████| 19.8MB 23kB/s 
Installing collected packages: scipy 
Successfully installed scipy-0.15.1 
21

以下爲我工作:

sudo apt-get install gfortran

我的系統上:

的Ubuntu 15.10(Linux的4.2.0-19泛型#23,Ubuntu的x86_64的x86_64的x86_64的GNU/Linux)

+3

OP詢問OS X. – Blaszard

+0

無論如何,這對Ubuntu而言並不像升級pip一樣。 –