主要利用python的wmi模块,提供非常多的信息。
import wmidef sys_version():
c = wmiWMI()
# *** 作系统版本,版本号,32位/64位
print('\nOS:')
sys = cWin32_OperatingSystem()[0]
print(sysCaption, sysBuildNumber, sysOSArchitecture)
# CPU类型 CPU内存
print('\nCPU:')
processor = cWin32_Processor()[0]
print(processorNamestrip())
Memory = cWin32_PhysicalMemory()[0]
print(int(MemoryCapacity)//1048576,'M')
# 硬盘名称,硬盘剩余空间,硬盘总大小
print('\nDISK:')
for disk in cWin32_LogicalDisk(DriveType=3):
print(diskCaption,'free:', int(diskFreeSpace)//1048576,'M\t', 'All:', int(diskSize)//1048576,'M')
# 获取MAC和IP地址
print('\nIP:')
for interface in cWin32_NetworkAdapterConfiguration(IPEnabled=1):
print("MAC: %s" % interfaceMACAddress)
for ip_address in interfaceIPAddress:
print("\tIP: %s" % ip_address)
# BIOS版本 生产厂家 释放日期
print('\nBIOS:')
bios = cWin32_BIOS()[0]
print(biosVersion)
print(biosManufacturer)
print(biosReleaseDate)
sys_version()
显示:
OS:Microsoft Windows 10 专业版 17134 64 位
CPU:
Intel(R) Core(TM) i5-7300HQ CPU @ 250GHz
8192 M
DISK:
C: free: 34165 M All: 120825 M
D: free: 265648 M All: 390777 M
E: free: 35669 M All: 204796 M
F: free: 5814 M All: 28163 M
G: free: 328650 M All: 329999 M
IP:
MAC: 00:50:56:C0:00:01
IP: 1921681821
IP: fe80::e0fb:efd8:ecb0:77f4
MAC: 00:50:56:C0:00:08
IP: 1921682131
IP: fe80::8da1:ce76:dae:bd48
MAC: 54:E1:AD:77:57:AB
IP: 192168199105
IP: fe80::aca8:4e6f:46e7:ef4a
BIOS:
LENOVO - 1
LENOVO
20170518000000000000+000
基于官方文档:
>
The module - psutil is what you want
easy_install psutil
or
pip install psutil
-
以上就是关于利用python写一段读取电脑配置信息的程序全部的内容,包括:利用python写一段读取电脑配置信息的程序、python 多进程、python实现对本机和批量远程服务器的cpu负载的获取,怎么实现等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)