一、概述
Numpy :
主要用来做一些科学运算,主要是矩阵的运算。NumPy为Python带来了真正的多维数组功能,并且提供了丰富的函数库处理这些数组。它将常用的数学函数都进行数组化,使得这些数学函数能够直接对数组进行操作,将本来需要在Python级别进行的循环,放到C语言的运算中,明显地提高了程序的运算速度。【1】
Scipy:
主要是一些科学工具集,信号处理工具集(如线性代数使用LAPACK库,快速傅立叶变换使用FFTPACK库)及数值计算的一些工具(常微分方程求解使用ODEPACK库,非线性方程组求解以及最小值求解等)【1】。
Scikit-learn:
里面有很多机器学习相关的算法(如聚类算法,SVM等)。【2】
Matplotlib:
是一个画图工具和Matlab中的画图工程类似。
二、安装
Ubuntu 下的安装
window 下的安装
到下面的网址下载自己的需要的exe文件,然后直接安装就即可。
Numpy
http://sourceforge.net/projects/numpy/files/NumPy/1.9.0/
Scipy
http://sourceforge.net/projects/scipy/files/
Matplotlib
http://jaist.dl.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.4.0/
scikit-learn下载地址:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikit-learn
在下载以上扩展库时,需注意python安装的版本和系统版本。例如笔者安装的是python2.7,64位,则下载这两版本的工具库进行安装。
三、安装过程问题及解决方案
安装时无法识别已安装的Python,这是由于Windows版本的原因,win7是 64的,在安装python(32位)时,如果选择只为当前用户,以上问题是不会出现的。
#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
# http://www.pythonware.com/products/works/articles/regpy20.htm
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/[email protected]/msg10512.html
import sys
from _winreg import *
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
installpath, installpath, installpath
)
def RegisterPy():
try:
reg = OpenKey(HKEY_CURRENT_USER, regpath)
except EnvironmentError as e:
try:
reg = CreateKey(HKEY_CURRENT_USER, regpath)
SetValue(reg, installkey, REG_SZ, installpath)
SetValue(reg, pythonkey, REG_SZ, pythonpath)
CloseKey(reg)
except:
print "*** Unable to register!"
return
print "--- Python", version, "is now registered!"
return
if (QueryValue(reg, installkey) == installpath and
QueryValue(reg, pythonkey) == pythonpath):
CloseKey(reg)
print "=== Python", version, "is already registered!"
return
CloseKey(reg)
print "*** Unable to register!"
print "*** You probably have another Python installation!"
if __name__ == "__main__":
RegisterPy()
运行这个python程序,显示“python 2.7 is already registered”,再安装上面扩展库时,就能自动识别出来python2.7了。