64位系统装32位的Python,Python version 3.5 required, which was not found,DLL load failed

来源:互联网 发布:狼人杀online for mac 编辑:程序博客网 时间:2024/05/29 14:40

     64位系统装了32位的Python,安装exe格式对应python版本相关的包,报错:Python version 3.5 required, which was not found in the registry。

     原因是注册表缺少Python安装信息,安装时,要注意选择。


64位系统32位Python,如果使用pywin32出现DLL load failed

复制文件夹  

C:\Program Files (x86)\Python36-32\Lib\site-packages\pywin32_system32\

内的文件:
            pythoncom36.dll
            pywintypes36.dll

到文件夹
C:\Windows\SysWOW64\


+++++++++++++++++++++++++++++++++++++++++

1.右键安装包,“以管理员权限运行”


2.勾选“add Python 3.5 to PATH”,选择“customize installation”



3.注意,勾选“for all users”就需要管理员权限运行。



4.勾选“Install for all users”,安装。




当然,你也可以选择使用下面了py脚本来添加Python安装信息:

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:            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()


0 0
原创粉丝点击