在Python中检测graphics驱动程序信息

我有一个应用程序需要NVIDIA的graphics驱动程序安装工作的最低版本。 我怎样才能得到在Windows上通过Python安装的驱动程序版本?

编辑:

一种通过registry来完成这个操作的方法,它可以让你安装所有版本(Yojimbo提供)

cmd = r'reg query "HKEY_LOCAL_MACHINE\SOFTWARE\NVIDIA Corporation\Installer2\Stripped" /s | find "Display.Driver/"' output = subprocess.check_output(cmd, shell=True) all = [float(x) for x in re.findall('Display\.Driver/(\d+\.?\d*)', str(output))] latest = max(all) 

您可能可以使用需要PyWin32的wmi模块。 像这样的东西,也许:

 import wmi c = wmi.WMI() video = c.Win32_videocontroller print video.properties 

我目前没有一个真正的Windows机器,我的Windows VM正在返回一堆Nones,但我认为这应该可以工作。

上面提到的WMI方法将为您提供文件版本,而不是您期望的实际驱动程序版本。 您需要安装NVidia WMI并连接到root / CIMV @ / NV命名空间,您可以在其中找到带有提供驱动程序版本的verDisplayDriver属性的System对象。

 nvidia = wmi.WMI(computer, user=r"usern", password="pass", namespace="/root/cimv2/NV", find_classes=True) for o in nvidia.System() : print o.verDisplayDriver.strValue