Thursday, April 8, 2010

[Python] Install numpy, scipy, PIL without root privilege on Linux

0. install python (in your local path) [1]
(1) download 'Python 2.7.3' from http://www.python.org/download/ .

(2) untar it and move to the directory where the python is.
(3) run the following commands.

>> mkdir /home/gunhee/lib/python-2.7.3/
>> cd Python-2.7.3
>> make clean
>> ./configure --prefix=/home/gunhee/lib/python-2.7.3/
>> make
>> make install
(4) Now you need to change the default python to your local one.
There are two different ways to do it. (1) symbolic links (2) add path to your '.bashrc'.
For (2), add the following line into your '.bashrc'.

# Add PATH for local python
PATH=$HOME/lib/python-2.7.3/bin:$PATH

1. install numpy
(1) download 'numpy-1.7.0.tar.gz' from http://sourceforge.net/projects/numpy/ .
(2) untar it and move to the directory where the numpy is.
(3) run >> python setup.py install --home=~/lib/python-2.7.3/ [2]. (The tilde is my home directory, but it is OK with any path you want). 
(4) Add the following line into your .bashrc [3].
(Assume that your numpy is located in ~/lib/python-2.7.3/lib/python/numpy).
export PYTHONPATH=$HOME/lib/python-2.7.3/lib/python:$PYTHONPATH

(5) Make sure that the numpy is successfully installed.
(check by this example >> python -c "import numpy; print numpy.__file__". There must be no error.

2. install scipy
(1) download 'scipy-0.12.0.zip' from http://sourceforge.net/projects/scipy/files/

(2) Install BLAS and LAPACK. Refer to [4]. (This step is not required any more). 
(3) run >> python setup.py install --home=~/lib/python-2.7.3/.

(4) Make sure that the scipy is successfully installed.
(check by this example >> python -c "import scipy; print scipy.__file__".

3. install PIL
(1) download PIL ('Imaging-1.1.7.tar.gz') from http://www.pythonware.com/products/pil/ .

(2) untar it and move to the directory where the PIL is.

(3) run >> python setup.py install --home=~/lib/python-2.7.3/.
(4) Add the following line into your '.bashrc' [3].
export PYTHONPATH=$HOME/lib/python-2.7.3/lib/python/PIL:$PYTHONPATH


Reference


1 comment:

latesttechnologyblogs said...

Thanks for sharing amazing information about python .Gain the knowledge and hands-on experience in python Online Training