Installation of Python scientific computing packages NumPy and scipy under Linux

Source: Internet
Author: User
Tags lapack gfortran

System environment:

Os:redhat5

Python version: Python2.7.3

GCC version: 4.1.2

Individual installation package Versions:

scipy-0.11.0

numpy-1.6.2

nose-1.2.1

lapack-3.4.2

atlas-3.10.0

Dependencies: The installation of scipy relies on NumPy, Lapack, Atlas (both of which are linear algebra toolkits), while the test programs for NumPy and SCI depend on nose, so the entire installation process must be executed sequentially, otherwise it cannot be executed.

Installation steps:

1, installation nose

This installation is relatively simple, unzip the nose installation files, enter the nose directory, directly run setup.py can:

TAR-ZXVF nose-1.2.1.tar.gz

CD nose-1.2.1

Python setup.py Install

2, installation Lapack

Since the latest version of Atlas can be compiled directly with the Lapack installation zip file, it is not necessary to install lapack if it is used only under Python. Just download the compressed file: Lapack-3.4.2.tgz can be.

3. Install Atlas

This installation is mainly about configuring options, including configuration as 64-bit library files, location-independent, and shared link libraries. Detailed configuration instructions are in the PDF file under Atlas installation package doc/. can be consulted.

Here is my installation process:

TAR-JXVF atlas3.10.0.tar.bz2

CD ATLAS

mkdir obj64

.. /configure-b 64-FA alg-fpic-shared--prefix=/Configuring the installation path for Atlas/atlas--with-netlib-lapack-tarfile=/lapack Installing compressed Files directory/ Lapack-3.4.2.tgz

(Note: This configuration time is very long, in the Core i7 processing, about 1 hours or so)

Make

(Here are some inspection procedures to ensure that there are no problems before installing)

Make check

Make time

Make install

At this point, the Atlas installation is complete. However, we want to record the type of Fortran compiler used in the compilation process, this information is used when installing numpy and scipy below. or under Directory obj64/, execute the

Fgrep "F77 =" make.inc
can see F77 =gfortran
Note This compiler type Gfortran.

4, Installation NumPy

The installation process for both NumPy and scipy explicitly indicates the type of Fortran compiler used, and it is important to be consistent with the previous compilation of Atlas (in this article: Gfortran), otherwise many functions will go wrong.

First configure the Site.cfg file in the NumPy directory to indicate the location of the Atlas library:

Tar-zxvfnumpy-1.6.2.tar.gz

CD numpy-1.6.2

CP Site.cfg.examplesite.cfg

Vim Site.cfg

Configured in the following format:

[DEFAULT]
Library_dirs =/usr/local/lib:/atlas's installation directory/atlas/lib
Include_dirs =/usr/local/include:/atlas's installation directory/include

[Blas_opt]
Libraries = F77blas, Cblas, Atlas

[Lapack_opt]
Libraries = Lapack, F77blas, Cblas, Atlas

[AMD]
Amd_libs = AMD
[Umfpack]
Umfpack_libs = Umfpack

Next configure the type of FORTRAN compiler required to install NumPy:

If the previously obtained Fortran compiler is Gfortran, execute:

python setup.pybuild--fcompiler=gnu95

If the previously obtained Fortran compiler is G77, execute:

python setup.pybuild--fcompiler=gnu

And then execute

Python Setup.pyinstall

Installation Complete

5, Installation SciPy

Similar to installing NumPy:

Tar-zxvfscipy-0.11.0.tar.gz

cdscipy-0.11.0

Vim Site.cfg

Configured in the following format:

[DEFAULT]
Library_dirs =/usr/local/lib:/atlas's installation directory/atlas/lib
Include_dirs =/usr/local/include:/atlas's installation directory/include

[Blas_opt]
Libraries = F77blas, Cblas, Atlas

[Lapack_opt]
Libraries = Lapack, F77blas, Cblas, Atlas

[AMD]
Amd_libs = AMD
[Umfpack]
Umfpack_libs = Umfpack

Next configure the type of FORTRAN compiler required to install NumPy:

If the previously obtained Fortran compiler is Gfortran, execute:

python setup.pybuild--fcompiler=gnu95

If the previously obtained Fortran compiler is G77, execute:

python setup.pybuild--fcompiler=gnu

And then execute

Python Setup.pyinstall

Installation Complete

You can then execute the appropriate test program under Python:

Python

>>>Import nose

>>> Import numpy

>>>Import scipy

>>>numpy.test (' full ')

>>>scipy.test (' full ')

REF:

Http://blog.sina.com.cn/s/blog_62dfdc740101aoo6.html

Installation of Python scientific computing packages NumPy and scipy under Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.