you're probably running inside a thread without first calling pythoncom.CoInitialize
后来在网上搜索,看到必须添加初始化函数和去初始化函数
import pythoncom
import wmi
pythoncom.CoInitialize ()
c = wmi.WMI ()
#
# do things
#
pythoncom.CoUninitialize ()
学习链接: https://bytes.com/topic/python/answers/608938-importing-wmi-child-thread-throws-error https://www.baidu.com/link?url=B5abgKIN6BuQtB0JEulod3HFD2MPtxU-UN_c7DSCihXJ_0aI3ugXuX5jy8xxR0kBoVg75aqgUDnU-NLcvWgcYs1SEFPOJ7S86bhDNoXFTEm&wd=&eqid=ecd0c574000392c60000000258f70637