不能在注册表中识别出来python时的解决方法
2014-12-01 16:54
197 查看
新建一个register.py 文件,把以下代码贴进去,保存(G盘)
输入以下命令(register.py 存放在 G盘底下)
![](http://pic002.cnblogs.com/images/2012/370308/2012052400040771.png)
显示“python 2.7 is already registered”
再安装biopython的时候,就能自动识别出来python2.7了。
win7是 64的原因,在安装python(32位)时,如果选择只为当前用户,以上问题是不会出现的,如果选择所有用户,那就用上面的方法解决吧。
代码来自:http://tech.valgog.com/2010/01/after-installing-64-bit-windows-7-at.html
# # 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/distutils-sig@python.org/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()
输入以下命令(register.py 存放在 G盘底下)
![](http://pic002.cnblogs.com/images/2012/370308/2012052400040771.png)
显示“python 2.7 is already registered”
再安装biopython的时候,就能自动识别出来python2.7了。
win7是 64的原因,在安装python(32位)时,如果选择只为当前用户,以上问题是不会出现的,如果选择所有用户,那就用上面的方法解决吧。
代码来自:http://tech.valgog.com/2010/01/after-installing-64-bit-windows-7-at.html
相关文章推荐
- 安装numpy,setuptools的时候,不能再注册表中识别出来python2.7
- SWFUpload与CI不能正确上传识别文件MIME类型解决方法分享
- Ubuntu 下不能识别android设备的解决方法
- win7光驱不能用不被系统所识别的解决方法
- Ubuntu中virtualbox不能识别USB设置的解决方法
- android选项卡不能在屏幕下方显示出来,解决方法
- 移动硬盘不能自动识别解决方法
- ubuntu下解决不能识别外部设备的方法
- 80004005 常见错误 不能打开注册表关键字 解决方法
- linux usb不能识别解决方法
- Ubuntu下解决不能识别外部设备的方法
- ubuntu 下不能识别 eth0 解决方法
- len(),lift(),right()不能正常识别中文的解决方法
- 在ubuntu下,eclipse不能识别手机的解决方法
- hibernate中查询出来的字段并不能自动转换为bean对象的解决方法
- win7 注册表 不能修改编辑 解决方法
- 在ubuntu下,eclipse不能识别手机的解决方法
- 解决IE不能主动识别UTF-8编码的问题的方法
- win2003不能识别移动硬盘的解决方法
- 解决eclipse导入web工程不能识别为web工程的方法