linux安装netcdf4教程,Linux Ubuntu安装netcdf4.4

本文详细指导了如何使用Intel的ifort编译器,并依次安装zlib、szip、hdf5和NetCDF-C/Fortran,包括配置、编译和环境变量设置,以确保netcdf4的顺利安装和集成.

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. Fortran编译器是Intel的ifort,终端中输入:

export CC=icc

export CXX=icpc

export FC=ifort

export F90=ifort

export F77=ifort

由于安装netcdf4需要zlib和hdf5,我们将把这些安装在同一个目录下,方便后面的环境变量配置

2. 安装zlib

下载地址:ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/

解压 tar -zxvf zlib-1.2.8.tar.gz

配置安装信息:./configure --prefix=/usr/local/netcdf4-needed

编译:make

检查:make check

安装:make install

安装完成之后会在/usr/local/netcdf4-needed这个目录下生成三个文件lib include share

3.安装szip

下载地址:ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/

解压 tar -zxvf slib-2.1.tar.gz

配置安装信息:./configure --prefix=/usr/local/netcdf4-needed

编译:make

检查:make check

安装:make install

安装完成之后会在/usr/local/netcdf4-needed这个目录下生成三个文件lib include share

4.安装hdf5

下载地址:ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/

解压 tar -zxvf hdf5-1.8.13.tar.gz

配置安装信息. ./configure --prefix=/usr/local/netcdf4-needed --with-zlib=/usr/local/netcdf4-needed/

编译:make

检查:make check

安装:make install

5.安装netcdf-c

下载地址 ftp://ftp.unidata.ucar.edu/pub/netcdf/old/

解压 tar -zxvf netcdf-4.3.2.tar.gz

配置安装信息 CPPFLAGS=-I/usr/local/netcdf4-needed/include LDFLAGS=-L/usr/local/netcdf4-needed/lib ./configure --prefix=/usr/local/netcdf4-needed --disable-dap

编译:make

检查:make check

安装:make install

6.安装netcdf-fortran

告知库文件位置.终端中输入 export LD_LIBRARY_PATH=/usr/local/netcdf4-needed/lib:$LD_LIBRARY_PATH

解压tar -zxvf netcdf-fortran-4.4.0.tar.gz

配置安装信息 CPPFLAGS=-I/usr/local/netcdf4-needed/include LDFLAGS=-L/usr/local/netcdf4-needed/lib ./configure --prefix=/usr/local/netcdf4-needed --disable-dap

编译:make

检查:make check

安装:make install

7.环境变量,bashrc中添加

#netcdf4.4

export NETCDF=/usr/local/netcdf4-needed

export PATH=$NETCDF/bin:$PATH

export LD_LIBRARY_PATH=$NETCDF/lib:$LD_LIBRARY_PATH

export CPPFLAGS='-I/usr/local/netcdf4-needed/include'

export LDFLAGS='-L/usr/local/netcdf4-needed/lib'

终端运行source ~/.bashrc

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值