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

红太狼 2022-09-27 15:22 15阅读 0赞

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

SouthEast

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

SouthEast 1

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

SouthEast 2

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

SouthEast 3

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

  1. import sys
  2. from _winreg import *
  3. version = sys.version[:3]
  4. installpath = sys.prefix
  5. regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
  6. installkey = "InstallPath"
  7. pythonkey = "PythonPath"
  8. pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
  9. installpath, installpath, installpath
  10. )
  11. def RegisterPy():
  12. try:
  13. reg = OpenKey(HKEY_CURRENT_USER, regpath)
  14. except EnvironmentError as e:
  15. try:
  16. reg = CreateKey(HKEY_CURRENT_USER, regpath)
  17. SetValue(reg, installkey, REG_SZ, installpath)
  18. SetValue(reg, pythonkey, REG_SZ, pythonpath)
  19. CloseKey(reg)
  20. except:
  21. print "*** Unable to register!"
  22. return
  23. print "--- Python", version, "is now registered!"
  24. return
  25. if (QueryValue(reg, installkey) == installpath and
  26. QueryValue(reg, pythonkey) == pythonpath):
  27. CloseKey(reg)
  28. print "=== Python", version, "is already registered!"
  29. return
  30. CloseKey(reg)
  31. print "*** Unable to register!"
  32. print "*** You probably have another Python installation!"
  33. if __name__ == "__main__":
  34. RegisterPy()

发表评论

表情:
评论列表 (有 0 条评论,15人围观)

还没有评论,来说两句吧...

相关阅读

    相关 32电脑64Python

    本文将从多个方面详细阐述在32位电脑上安装64位Python的方法和注意事项。 一、64位Python简介 1、64位Python是指Python编程语言的64位版本。

    相关 3264区别

    主要是看寻址能力的大小. X86(32位) X64 编程差别: 32位:地址为32,2^32 能使用 4G 内存, 64位:地址为64,2^64 能使用