Python version 3.6 required, which was not found in the registry错误解决

Posted Hank

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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()

 

以上是关于Python version 3.6 required, which was not found in the registry错误解决的主要内容,如果未能解决你的问题,请参考以下文章

Windows下 Tensorflow安装问题: Could not find a version that satisfies the requirement tensorflow

爬坑Python 3.6 在 Socket 编程时出现类型错误 TypeError: a bytes-like object is required, not 'str'(示例代码(代

Python argparse required=True 但 --version 功能?

05_Python Format Operation

要求:安装 iRedMail 时 Centos 7 上的 python(abi) = 3.6

python version 2. required,which was not found in the registry 解决方案