Python34安装NumPy
numpy 准确地说提供了一个在python中做科学计算的基础库,侠义地讲它重在数值计算,甚至可以说是用于多维数组处理的库;而 scipy 则是基于numpy,提供了一个在python中做科学计算的工具集,也就是说它是更上一个层次的库。
下面只介绍numpy的安装方法(scipy一样)
本机环境:win7, 64位 + python3.4
1、下载对应版本NumPy(我用的python3.4下载对应numpy-1.9.2+unoptimized-cp34-none-win amd64.whl)
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
python3.4 Delbert默认版本为3.4,第二步不用执行。2.7的就得安装wheel
2、由于下载下来的包是wheel格式的,需要wheel支持。所以需要先通过cd命令切换到python安装路径下的Script文件夹,输入 pip install wheel 来安装wheel。
C:Python34Scripts>pip install wheel
You are using pip version 6.0.8, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command. Collecting wheel
Downloading wheel-0.24.0-py2.py3-none-any.whl (63kB)
100% |################################| 65kB 113kB/s
Installing collected packages: wheel
Successfully installed wheel-0.24.0
3、 pip install 来进行安装
C:Python34Scripts>pip install C:Python34
umpy-1.9.2+unoptimized-cp34-none-w in32.whl
You are using pip version 6.0.8, however version 7.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command. Processing c:python34
umpy-1.9.2+unoptimized-cp34-none-win32.whl
Installing collected packages: numpy Successfully installed numpy-1.9.2
4、进入python运行环境(cmd)
C:Python34Scripts>C:Python34python.exe
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
在python下导入numpy
>>>; from numpy import *
安装完成,可以测试了。
4*4的随机数组:
>>> random.rand(4,4)
array([[ 0.90056883, 0.10542202, 0.02104658, 0.45606525],
[ 0.37256702, 0.38938058, 0.81695404, 0.3021916 ],
[ 0.02081778, 0.65920287, 0.18204678, 0.70915739],
[ 0.74607969, 0.9682355 , 0.49196832, 0.74588514]])
>>>