This article provides you the essential instruction in order to install netcdf.
NetCDF is a set of software libraries and self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. You can also find more about NetCDF from http://www.unidata.ucar.edu/software/netcdf/. But I just here only discuss how to install different versions of netcdf. For installing NetCDF in python following steps take in to consideration.
1. Download the Netcdf from
http://www.unidata.ucar.edu/software/netcdf/
2. The Netcdf versions above 4 needs HDF to install as prerequisite.
3. If you want to install Version 4 (or above) you must have the HDF5 1.8.6 release, You must also have the zlib compression library, version 1.2.5. Both of these packages are available from the netCDF-4 ftp site at ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.
4. You can also install Netcdf without HDF support by following bash commands.
./configure --prefix=/home/ed/local --disable-netcdf-4
make check install
5. If you want to install Netcdf3.6.2, you just need to download it and then unzip the folder.
netcdf-3.6.2.tar.gz - Binary distribution of netcdf-3.6.2 on linux_2.6-x86_64.
$ tar xvf netcdf-3.6.2.tar.gz
$ cd netcdf-3.6.2
netcdf-3.6.2$./configure
netcdf-3.6.2$ make check
netcdf-3.6.2$ make install
$ sudo apt-get install python-netcdf
Unidata doesn't distribute a Python API with it's netCDF software. So installing the netCDF library
will not also install a Python netCDF library. You will have to obtain and install the Python library
separately, after installing the netCDF library.
Hope this would help.