基本上是参考这篇文章来实现https://www.jianshu.com/p/49c590ee974c
项目环境:
- win7操作系统
- python3.8.0
基本配置,安装
vs2019,导入项目OpenHardwareMonitorLib,并把OpenHardwareMonitorLib.dll文件放到D盘下面
Note that you need to have pip, wheel, setuptools installed,使用以下命令:
C:\Program Files\Python38\Scripts>python -m pip install --upgrade pip setuptools wheel
wheel是下载的https://www.lfd.uci.edu/~gohlke/pythonlibs/#pythonnet
使用以下命令安装:
pip install C:\Users\XXX\Downloads\matplotlib-2.1.2-cp27-cp27m-win_amd64.whl
Python文件,moni.py如下
#!/usr/bin/env python
#coding=utf-8
import clr
import time
clr.AddReference("D:\OpenHardwareMonitorLib.dll") #加载C#的库这