Install NumPy and scipy under Linux

Source: Internet
Author: User
Tags lapack

The two scientific computing packages under Python SciPy and numpy are more dependent, and the installation process is more complex.

Individual installation packages:
scipy-0.19.0 Download: https://github.com/scipy/scipy/releases
numpy-1.9.0 Download: HTTPS://SOURCEFORGE.NET/PROJECTS/NUMPY/FILES/NUMPY/1.9.0/NUMPY-1.9.0.ZIP/DOWNLOAD?USE_MIRROR=NCHC
nose-1.1.2 Download: https://pypi.python.org/packages/38/96/ 7aa1c2583ddec558a230175d6aeddba796cde7191852bf3e6eb3cfb873e1/nose-1.1.2.tar.gz
lapack-3.7.0 Download: www.netlib.org/lapack/lapack-3.7.0.tgz
atlas-0.27.0 Download: https://pypi.python.org/pypi/atlas/0.27.0

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

Installation steps:
1, installation nose

Unzip the nose installation file, enter the nose directory, run the setup.py directly:

[Plain]View PlainCopy
    1. TAR-ZXVF nose-1.2.1.tar.gz
    2. CD nose-1.2.1
    3. Python setup.py Install

Note : The python command might be to start python2, and if you need to run these libraries in a python3 environment, you need to install Python3 first.

When installing these libraries, use the Python3 command: Python3 setup.py install. (This is not required if the default Python starts Python3)

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.7.0.tgz can be.

3. Install Atlas

[Plain]View PlainCopy
    1. TAR-ZXVF atlas-0.27.0.tar.gz
    2. CD atlas-0.27.0
    3. Python setup.py Install

4, Installation NumPy

Recommended use of the source code installation: After download unzip, go to the folder, directly run the installation files

[Plain]View PlainCopy
    1. Unzip Numpy-1.9.0.zip
    2. CD numpy-1.9.0
    3. Python setup.py Install

Wait for the installation to complete.

Note: During the installation process, you may be prompted for missing Python-dev or python-devel to install Python-devel in the CentOS system.

To test whether the installation was successful:

5, Installation SciPy
TAR-ZXVF scipy-0.19.0.tar.gz

CD scipy-0.19.0

CP lapack-3.7.0.tgz

Python setup.py Install

Wait for the installation to complete.

Note : The scipy installation relies on lapack, so at the time of installation, Lapack's compressed package is copied to the scipy-0.19.0 directory, and lapack-3.7.0.tgz can be decompressed if needed.

You can also execute the following directives:

Yum install lapack lapack-devel Blas Blas-devel

Note : If, after installing a library, you enter the Python environment and import the library through import without exiting the installation folder, you will be prompted with the following:

"Importerror:error importing numpy:you should not try-to-import numpy > from its source directory; Please exit the NumPy source tree, and > relaunch your Python intepreter from there.

You should exit the installation folder at this time before entering the Python Environment import library.

Installing NumPy and scipy under Linux

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.