zoukankan      html  css  js  c++  java
  • Python version 3.6 required, which was not found in the registry错误解决

    问题:

    安装pywin32出现Python version 3.6 required, which was not found in the registry错误解决

    解决:

    建立一个文件 register.py 内容如下. 然后执行该脚本. 

    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()
  • 相关阅读:
    Django 想要单独执行文件
    Django基础
    Bootstrap框架
    Font Awesome矢量图标框架
    js函数式编程——蹦床函数
    ie被hao.360劫持的解决方法
    函数式编程——惰性链
    你可能不知道的BFC在实际中的应用
    高度随宽度适应的响应式方案
    腾讯云播放器更新——TCplayer
  • 原文地址:https://www.cnblogs.com/hankleo/p/10358556.html
Copyright © 2011-2022 走看看