目录
第三步,把注册表中文件夹3.6改为3.6或者3.6-32即可!
第四步,重新运行pywin32-221.win-amd64-py3.6.exe,重新安装pywin32
解决问题
安装pywin32时出现python version 3.6 required, which was not found in the registry
或者
安装pywin32时出现python version 3.6-32 required, which was not found in the registry
解决方法
第一步,打开注册编辑器:regedit
第二步,如图所示,定位到python
注意:如果没有,则执行下列命令会在注册编辑器里自动生成。
1. from __future__ import print_function 2. 3. import sys 4. 5. try: 6. from winreg import * 7. except ImportError: 8. from _winreg import * 9. 10. # tweak as necessary 11. version = sys.version[:3] 12. installpath = sys.prefix 13. 14. regpath = "SOFTWARE\\Python\\Pythoncore\\{0}\\".format(version) 15. installkey = "InstallPath" 16. pythonkey = "PythonPath" 17. pythonpath = "{0};{1}\\Lib\\;{2}\\DLLs\\".format( 18. installpath, installpath, installpath) 19. 20. 21. def RegisterPy(): 22. try: 23. reg = OpenKey(HKEY_CURRENT_USER, regpath) 24. except EnvironmentError as e: 25. try: 26. reg = CreateKey(HKEY_CURRENT_USER, regpath) 27. SetValue(reg, installkey, REG_SZ, installpath) 28. SetValue(reg, pythonkey, REG_SZ, pythonpath) 29. CloseKey(reg) 30. except: 31. print("*** Unable to register!") 32. return 33. print("--- Python", version, "is now registered!") 34. return 35. if (QueryValue(reg, installkey) == installpath and 36. QueryValue(reg, pythonkey) == pythonpath): 37. CloseKey(reg) 38. print("=== Python", version, "is already registered!") 39. return 40. CloseKey(reg) 41. print("*** Unable to register!") 42. print("*** You probably have another Python installation!") 43. 44. 45. if __name__ == "__main__": 46. RegisterPy()
再次进入注册表编辑器,查看即可
第三步,把注册表中文件夹3.6改为3.6或者3.6-32即可!
根据要求提示进行更改,把注册表中文件夹3.6改为3.6或者3.6-32
第四步,重新运行pywin32-221.win-amd64-py3.6.exe,重新安装pywin32
大功告成!
参考文章:https://blog.csdn.net/weixin_42762089/article/details/84781599