1、安装WinPython 集成计算包
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 02 16:26:52 2015
@author: dapenghuang
"""
import sys
from _winreg import *
# tweak as necessary
version = sys.version[:3]
installpath = "E:\python\winpython_anzhuang\WinPython-32bit-2.7.10.1\python-2.7.10" #更换成python所在地址
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
installpath, installpath, installpath
)
def RegisterPy():
print "begin RegisterPy "
try:
print "open key : %s"%regpath
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 "*** EXCEPT: 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 "*** ERROR:Unable to register!"
print "*** REASON:You probably have another Python installation!"
def UnRegisterPy():
#print "begin UnRegisterPy "
try:
print "open HKEY_CURRENT_USER key=%s"%(regpath)
reg = OpenKey(HKEY_CURRENT_USER, regpath)
#reg = OpenKey(HKEY_LOCAL_MACHINE, regpath)
except EnvironmentError:
print "*** Python not registered?!"
return
try:
DeleteKey(reg, installkey)
DeleteKey(reg, pythonkey)
DeleteKey(HKEY_LOCAL_MACHINE, regpath)
except:
print "*** Unable to un-register!"
else:
print "--- Python", version, "is no longer registered!"
if __name__ == "__main__":
RegisterPy()
然后在在win7命令行中运行:
这样就成功向注册表中写入了相关Python安装信息。
出现下面即表示BeautifulSoup安装成功。
3、安装NeuroLab
NeuroLab是用Python编写的神经网络库。下面的页面下载Neurolab(http://code.google.com/p/neurolab/downloads/list地址因为谷歌被禁不能访问):
https://pypi.python.org/pypi/neurolab
解压后我用命令行运行如下命令一直未能成功:
改为使用WinPython自带的WinPython Control Panel进行安装,直接用WinPython Control Panel读取未解压前的NeuroLab文件,即可安装完毕,同时在python安装目录的Python27\Lib\site-packages下,就可以看到neurolab的文件夹。