另外有一些命令行工具也可以查看网速。你找一找。
如果都没有办法,你找一个winpcap,它有python的接口。这个安装完一定可以查看网络速度。
不过你仔细看一下windows的API中应该有查看适配器状态的功能。虽然没有网速,不过是否断开的状态是有的。
此外你也可以使用netstat工具,tcpdump工具,查看。把查看的结果变换一下,就是网络速度。
etUsage = Bytes Total / Current Bandwidth,一般带宽都是小b(位每秒),所以应该结果也是小b。
every network interface installed on the system
如果你的每个网卡都只有一个网口,你可以简单将网口理解为网卡。
你好,下面是windows的获取cpu频率的代码。def get_windows_cpu_speed():
import winreg
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"HARDWARE\DESCRIPTION\System\CentralProcessor\0")
speed, type = winreg.QueryValueEx(key, "~MHz")
speed = round(float(speed)/1024, 1)
return "{speed} GHz".format(speed=speed)