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

     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.右键安装包,“以管理员权限运行”

64位系统装32位的Python,Python version 3.5 required, which was not found,DLL load failed_第1张图片

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

64位系统装32位的Python,Python version 3.5 required, which was not found,DLL load failed_第2张图片


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

64位系统装32位的Python,Python version 3.5 required, which was not found,DLL load failed_第3张图片


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

64位系统装32位的Python,Python version 3.5 required, which was not found,DLL load failed_第4张图片



当然,你也可以选择使用下面了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()


你可能感兴趣的:(计算机维护)