1.安裝cygwin
2.雙擊運行
setup-x86.exe,從鏡像網站中下載安裝包至本地,不要在線安裝,選擇文件下載至local,並且手動點擊,實現所有的程序包的下載。在選擇鏡像網站的時候,可以選擇后綴為.jp的,也就是日本服務器,速度較快,全部下載之后大概有17G,可能需要一天時間下載
3.安裝cygwin,雙擊
setup-x86.exe開始安裝程序,選擇從本地文件安裝程序,在軟件安裝的時候,需要特別安裝以下插件,以保證后續的ncl安裝成功
- Category "Devel": install "autoconf", "binutils", "bison", "byacc", "flex", "gcc", "gcc4", "gcc4-fortran", "gcc-g++", "gdb", "make", "makedepend", "openssl-devel".
- Category "Editors": [optional] some popular editors that you might want for editing your files include "nedit", "emacs", and "vim".
- Category "Graphics": [optional] install "ghostscript" for viewing PostScript files, "ImageMagick" for "convert"
- Category "Libs": "expat", "libcurl4", "libexpat-devel", "libgfortran4", "libidn-devel", "libxml2", "libtirpc", "zlib"
- Category "Net": `install "libcurl-devel", "libcurl4", and "openssh".
- Category "Shells": install "bash", "sh-utils", "pdsh", and "tcsh".
- Category "X11": install all of the required packages that the "Installing Cygwin/X" section mentions (see #15 where it lists all the "X11" packages and whether they are required or optional).
4.下載ncl,選擇ncl在cygwin環境下的安裝包
ncl_ncarg-6.5.0-CYGWIN_NT-10.0-WOW_i686.tar.gz,下載
https://www.earthsystemgrid.org/dataset/ncl.650.dap/file.html
5.安裝ncl
mkdir /usr/local
cd /usr/local
gunzip /cygwin/home/JohnDoe/ncl_ncarg-6.5.0.CYGWIN_NT-10.0-WOW_i686.tar.gz
tar -xvf /cygwin/home/JohnDoe/ncl_ncarg-6.5.0.CYGWIN_NT-10.0-WOW_i686.tar
6.設置環境變量,生效環境變量,大功告成!
Every user of NCL needs to set their environment before they can use NCL. You can do this by opening your "c:\cygwin\home\xxx\.bashrc" (or "c:\cygwin\home\xxx\.bash_profile" if ".bashrc" doesn't exist) file with a UNIX editor and adding the lines:
export NCARG_ROOT=/usr/local
export PATH=/usr/local/bin:$PATH
csh/tcsh:
source ~/.cshrc
source ~/.tcshrc
bash/ksh:
. ~/.bashrc
. ~/.bash_profile
7.中間可能出現的問題
a.在cygwin中安裝ncl之后,運行ncl毫無反應,沒有報錯也沒有進入ncl
可能原因:很有可能是安裝64位的cygwin,導致沒有結果
Important note: Cygwin comes with two versions of the setup program. They are called setup-x86.exe and setup-x86_64.exe. Download the setup-x86.exe one, because the other one is for 64-bit Cygwin. NCL can't be installed under 64-bit Cygwin because there are many external packages that NCL depends on that aren't buildable under 64-bit Cygwin.
b.安裝ncl之后,運行ncl,報錯顯示缺少一些.dll文件,例如 error while loading shared libraries: cygmpfr-4.dll:cannot open shared object file: No such file or directory等
原因:安裝cygwin的時候選擇默認安裝插件,沒有手動選擇自己需要的,導致沒有安裝
解決方法:先檢查cygwin的安裝包是否包含上述插件,沒有則下載完成安裝包,重新安裝,在安裝的過程中不要需要默認形式,手動install,尤其注意選擇步驟3中的幾個插件,否則可能出錯
參考網站: