我一直在使用SpeedFan以GPU温度为目标来控制系统风扇。但是,SpeedFan现在对我来说根本无法使用,我找不到Windows 10应用程序,该应用程序可让您为GPU温度(而不是CPU温度)设置自定义系统风扇曲线。我看过一些建议使用wmi
模块的帖子,所以这是我尝试过的:
首先安装所需的模块:
pip install wmi
pip install pypiwin32
现在运行以下python代码:
import wmi
w = wmi.WMI(namespace="root\\wmi")
print((w.MSAcpi_ThermalZoneTemperature()[0].CurrentTemperature / 10.0) - 273.15)
但是,在具有管理员权限的命令提示符下运行时,会出现以下错误:
Traceback (most recent call last):
File "C:\Users\Alex\PycharmProjects\GPU-Fan-Controller\venv\lib\site-packages\wmi.py", line 817, in query
return self._namespace.query (wql, self, fields)
File "C:\Users\Alex\PycharmProjects\GPU-Fan-Controller\venv\lib\site-packages\wmi.py", line 1009, in query
return [ _wmi_object (obj, instance_of, fields) for obj in self._raw_query(wql) ]
File "C:\Users\Alex\PycharmProjects\GPU-Fan-Controller\venv\lib\site-packages\wmi.py", line 1009, in <listcomp>
return [ _wmi_object (obj, instance_of, fields) for obj in self._raw_query(wql) ]
File "C:\Users\Alex\PycharmProjects\GPU-Fan-Controller\venv\lib\site-packages\win32com\client\dynamic.py", line 252, in __getitem__
return self._get_good_object_(self._enum_.__getitem__(index))
File "C:\Users\Alex\PycharmProjects\GPU-Fan-Controller\venv\lib\site-packages\win32com\client\util.py", line 37, in __getitem__
return self.__GetIndex(index)
File "C:\Users\Alex\PycharmProjects\GPU-Fan-Controller\venv\lib\site-packages\win32com\client\util.py", line 53, in __GetIndex
result = self._oleobj_.Next(1)
pywintypes.com_error: (-2147217396, 'OLE error 0x8004100c', None, None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "src\test.py", line 114, in <module>
print((w.MSAcpi_ThermalZoneTemperature()[0].CurrentTemperature / 10.0) - 273.15)
File "C:\Users\Alex\PycharmProjects\GPU-Fan-Controller\venv\lib\site-packages\wmi.py", line 819, in query
handle_com_error ()
File "C:\Users\Alex\PycharmProjects\GPU-Fan-Controller\venv\lib\site-packages\wmi.py", line 241, in handle_com_error
raise klass (com_error=err)
wmi.x_wmi: <x_wmi: Unexpected COM Error (-2147217396, 'OLE error 0x8004100c', None, None)>
我还尝试使用Win32_Fan
类,但这也会导致错误。
我使用的主板是运行最新BIOS的ASUS X99 Strix,所有风扇均为PWM。
是否有解决这些问题的方法,或者使用python根据GPU温度控制风扇速度不是最佳解决方案?预先谢谢你。