Installing Python (Linux)

 

UPDATE: A better way… Installing Python with Anaconda

 


The approach used here to install Python is:

  1. First, we install Spyder (along with all the libraries that come with it)
  2. Then, we install additional libraries (than do not come with Spyder)

Spyder is a powerful interactive development environment (IDE) for the Python language… kinda’ a graphical (Matlab-looking) interface that allows you to easily write you Python code, run it, debug it, etc. Another nice thing… when installing Spyder, it automatically installs not only Python, but also a bunch of scientific libraries like NumPy, SciPy, Matplotlib and iPhyton.


Install Spyder in Linux (Ubuntu)

Install Spyder via Ubuntu Software Centre:

  1. Open the “Ubuntu Software Centre”
  2. Search for “spyder”
  3. Click install
  4. It should be installed under the “Scientific” menu

OR install Spyder via a terminal:

sudo apt-get install spyder


Install additional libraries

Basemap

You may be apble to search for “Basemap” in the software centre and click install… if not read below:

Instructions came from here: http://matplotlib.org/basemap/users/installing.html

  1. Download source tarballs here.
  2. Unpack, go into the directory and execute:
sudo python setup.py install

If it doesn’t work, execute the following:

cd geos-3.3.3
export GEOS_DIR=/usr/local
./configure --prefix=$GEOS_DIR
sudo make
sudo make install
cd ..
sudo python setup.py install

xlrd (read Excel files)

In “Ubuntu Software Centre”, search for “xlrd”. Click install.

Or… in terminal…

sudo apt-get install xlrd

h5py – Python interface to HDF5 file format

  1. Open “Software Centre”
  2. Search “h5py”
  3. Click install

Or… in terminal…

sudo apt-get install h5py

netcdf4-python

Instruction came from here: http://code.google.com/p/netcdf4-python/wiki/UbuntuInstall

First install HDF5

  1. Download the current HDF5 source release.
  2. Unpack, go into the directory and execute:
./configure --prefix=/usr/local --enable-shared --enable-hl
make
sudo make install

Download and install zlib library

  1. Download the current zlib.
  2. Unpack, go into the directory and execute:
./configure
make
sudo make install

Then install netCDF4

  1. Download the current netCDF4 source release.
  2. Unpack, go into the directory and execute:
LDFLAGS=-L/usr/local/lib CPPFLAGS=-I/usr/local/include ./configure --enable-netcdf-4 --enable-dap --enable-shared --prefix=/usr/local
make 
sudo make install

Finally, install netcdf4-python

  1. Download the current netcdf4-python source release
  2. Unpack, go into the directory and execute:
sudo ldconfig
sudo python setup.py install

Advertisements

2 thoughts on “Installing Python (Linux)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s