Python中的Numpy、SciPy、MatPlotLib安装与配置

Python安装完Numpy,SciPy和MatplotLib后,可以成为非常犀利的科研利器。本人搜索诸多安装教程后才找到正确的资源来配置,共享下。

    安装环境:64位python2.7

    下载http://pan.baidu.com/s/1c1Phqko中三个库的exe,因为MatplotLib的使用需要以Numpy的支持,所以先点击安装Numpy,其次是Scipy,最后是MatplotLib,一路点击next即可。

     安装时如果出现了Python 2.7 was not found in the registry的错误信息,则新建一个register.py,复制下面代码运行,输出:Python 2.7 is already registered就代表问题已解决。

# 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() 

猜你喜欢

转载自279234058.iteye.com/blog/2326693