1. 程式人生 > >python3.6安裝pywin32失敗

python3.6安裝pywin32失敗

安裝pywin32的時候介面提示沒有python沒有登錄檔資訊

登錄檔中沒有python路徑。 需要跑指令碼寫到登錄檔中去。 參考:

https://blog.csdn.net/stigin/article/details/55517842

http://www.mamicode.com/info-detail-1300944.html

解決辦法:  
1. 先在登錄檔中寫入Python3.5的安裝路徑。我在網上找到了登錄檔註冊的程式碼貼出來供大家使用。 

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()
2.然後在直接執行安裝檔案即可