numpy简介
numpy官网
NumPy is the fundamental package for scientific computing with Python. It contains among other things:
- a powerful N-dimensional array object
- sophisticated (broadcasting) functions
- tools for integrating C/C++ and Fortran code
- useful linear algebra, Fourier transform, and random number capabilities
Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container of generic data. Arbitrary data-types can be defined. This allows NumPy to seamlessly and speedily integrate with a wide variety of databases.
numpy是什么
- NumPy:N维数组容器
- NumPy(Numerrical Python 的缩写)是一个开源的Python科学计算库。使用NumPy,就可以很自然的使用数组
- NumPy包含很多实用的数学函数,涵盖线性代数运算、傅立叶变换和随机生成等功能
- Numpy是以矩阵为基础的数学计算模块,纯数学
- NumPy的线性代数模块会调用它,否则NumPy将使用自己实现的库函数。LAPACK是一个著名的数值计算库,最初是用Fortran写成的,Matlab同样也需要调用它
安装numpy
NumPy函数库是Python开发环境下的一个独立的模块。
可以使用两种方式进行安装:
- 第一种是采用pip方式:这种方式下载太慢了,放弃了。
- 第二种采用源码安装:步骤如下:
| 1.下载源码包:
wget https://sourceforge.net/projects/numpy/files/NumPy 下载zip和.tar.gz包都可以
| 2.解压
unzip numpy-1.11.2.zip 或者 tar zxvf numpy-1.11.2.tar.gz -C 指定目录
| 3.进入解压目录
cd numpy-1.11.2
| 4.运行解压目录里的setup.py 文件
sudo python setup.py install
| 5.测试是否安装成功: