1)安装pywin32
下载网址为:
https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/
(选择符合电脑上已安装python的位数的版本,可通过打开IDLE来查看)
运行.exe文件,可能会有如下提示:
Python version 3.6-32 required, which was not found in the registry.
原因是安装程序没有找到python注册表,先写用idle运行脚本程序将python写入注册表,代码如下:
#python3使用下列代码
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():</