zoukankan      html  css  js  c++  java
  • 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()
    
    
  • 相关阅读:
    Automatic Setup of a Humanoid
    SLAM——视觉里程计(一)feature
    JSP和EL和JSTL
    rework-发出你的心声
    bootstrap单选框复选框的使用
    bootstrap输入框组
    vue中改变数组或对象,页面没做出对应的渲染
    bootstrap面板的使用
    bootstrap列表组的使用
    bootstrap表格的使用
  • 原文地址:https://www.cnblogs.com/hello1123/p/7427662.html
Copyright © 2011-2022 走看看