anaconda2下安装psycopg2出现python 2.7 required not found in registry解决办法
2017-11-29 00:57
676 查看
文章参考:http://effbot.org/zone/python-register.htm
源码在我的PC上无法执行成功,经过小的修改,完成功能
源码在我的PC上无法执行成功,经过小的修改,完成功能
import sys from _winreg import * 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: print regpath reg = OpenKey(HKEY_LOCAL_MACHINE, regpath) if reg: if (QueryValue(reg, installkey) == installpath and QueryValue(reg, pythonkey) == pythonpath): CloseKey(reg) print "=== Python", version, "is already registered!" return else: SetValue(reg, installkey, REG_SZ, installpath) SetValue(reg, pythonkey, REG_SZ, pythonpath) # CloseKey(reg) print "--- Python", version, "is now registered!" except EnvironmentError: try: reg = CreateKey(HKEY_LOCAL_MACHINE, 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()
相关文章推荐
- 解决安装MySQL-python出现的:Python version 2.7 required, which was not found in the registry
- 解决安装MySQL-python出现的:Python version 2.7 required, which was not found in the registry
- [解决]在安装Python PIL 时出现错误: Python version 2.7 required, which was not found in the registry
- 安装PIL遇到python version 2.7 required, which was not found in the registry解决办法
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装Python-Matplotlib时出现的问题--Python version 2.7 required, which was not found in the registry
- 【转】安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装scipy或者numpy时弹出python2.7 was not found in the registry 的解决办法
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装PIL等库出现Python version2.7 required,which was not found in the registry.
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- 【已解决】PIL安装异常 “python version 2.7 required, which was not found in the registry.”
- 安装第三方库出现 Python version 2.7 required, which was not found in the registry
- python2安装PIL等第三方库提示Python version 2.7 required, which was not found in the registry的解决方法
- 安装win32com报错-Python Version 2.7 required which was not found in the registry 问题解决 .