import wmi def system(): pc=wmi.WMI() OS_INFO=pc.win32_OperatingSystem()[0] processor=pc.win32_Processor()[0] gpu=pc.win32_VideoController()[0] os_name=OS_INFO.Name.encode('utf-8').split(b'|')[0] ram=float(OS_INFO.ToTalvisibleMemorySize)/1048576 print("操作系统:{}".format(os_name)) print("cpu:{}".format(processor.Name)) print("内存:{}GB".format(ram)) print("显卡:{}".format(gpu.Name)) print("计算机信息如上\n") system()