• Python version 2.7 required, which was not found in the registry


    http://blog.csdn.net/zklth/article/details/8117207

     1 import sys
     2 
     3 from _winreg import *
     4 
     5 # tweak as necessary
     6 version = sys.version[:3]
     7 installpath = sys.prefix
     8 
     9 regpath = "SOFTWARE\Python\Pythoncore\%s\" % (version)
    10 installkey = "InstallPath"
    11 pythonkey = "PythonPath"
    12 pythonpath = "%s;%s\Lib\;%s\DLLs\" % (
    13     installpath, installpath, installpath
    14 )
    15 
    16 
    17 def RegisterPy():
    18     try:
    19         reg = OpenKey(HKEY_CURRENT_USER, regpath)
    20     except EnvironmentError as e:
    21         try:
    22             reg = CreateKey(HKEY_CURRENT_USER, regpath)
    23             SetValue(reg, installkey, REG_SZ, installpath)
    24             SetValue(reg, pythonkey, REG_SZ, pythonpath)
    25             CloseKey(reg)
    26         except:
    27             print "*** Unable to register!"
    28             return
    29         print "--- Python", version, "is now registered!"
    30         return
    31     if (QueryValue(reg, installkey) == installpath and
    32                 QueryValue(reg, pythonkey) == pythonpath):
    33         CloseKey(reg)
    34         print "=== Python", version, "is already registered!"
    35         return
    36     CloseKey(reg)
    37     print "*** Unable to register!"
    38     print "*** You probably have another Python installation!"
    39 
    40 
    41 if __name__ == "__main__":
    42     RegisterPy()
    
    
  • 相关阅读:
    Android之网络数据存储
    Android之ContentProvider数据存储
    类CL_ABAP_TYPEDESCR,动态取得运行时类型
    创建采购订单批到程序用的BAPI
    关于时间的函数
    去非数字字符串的前导零
    abap四舍五入的函数
    读取域的文本表
    PP屏幕增强点
    时间戳计算
  • 原文地址:https://www.cnblogs.com/hello1123/p/7427662.html
Copyright © 2020-2023  润新知