大佬们好,问下 Python 获取电脑硬件信息,类似鲁大师那种。

2020-10-20 08:06:22 +08:00
 legendnan
用 wmi 能获取到显卡信息,但是我的电脑上装有远程工具。现在读取到了 3 个信息。请问我要如何才能知道我用的是哪个?而且如果电脑有集成显卡跟独显,我想要独显的不要集成显卡,请问如何实现?

py 代码:
for xk in w.Win32_VideoController():
print(xk)
print("")

系统返回信息
instance of Win32_VideoController
{
AdapterCompatibility = "Intel Corporation";
AdapterDACType = "Internal";
AdapterRAM = 1073741824;
Availability = 3;
Caption = "Intel(R) HD Graphics 630";
ConfigManagerErrorCode = 0;
ConfigManagerUserConfig = FALSE;
CreationClassName = "Win32_VideoController";
CurrentBitsPerPixel = 32;
CurrentHorizontalResolution = 1680;
CurrentNumberOfColors = "4294967296";
CurrentNumberOfColumns = 0;
CurrentNumberOfRows = 0;
CurrentRefreshRate = 59;
CurrentScanMode = 4;
CurrentVerticalResolution = 1050;
Description = "Intel(R) HD Graphics 630";
DeviceID = "VideoController1";
DitherType = 0;
DriverDate = "20171115000000.000000-000";
DriverVersion = "21.20.16.4860";
InfFilename = "oem6.inf";
InfSection = "iKBLD_w7";
InstalledDisplayDrivers = "igdumdim64.dll,igd10iumd64.dll,igd10iumd64.dll,igdumdim32,igd10iumd32,igd10iumd32";
MaxRefreshRate = 75;
MinRefreshRate = 59;
Monochrome = FALSE;
Name = "Intel(R) HD Graphics 630";
PNPDeviceID = "PCI\\VEN_8086&DEV_5912&SUBSYS_7A741462&REV_04\\3&11583659&0&10";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "PC-20190727BPDJ";
VideoArchitecture = 5;
VideoMemoryType = 2;
VideoModeDescription = "1680 x 1050 x 4294967296 colors";
VideoProcessor = "Intel(R) HD Graphics Family";
};



instance of Win32_VideoController
{
AdapterCompatibility = "Shanghai Best Oray Information Technology Co., Ltd.";
Availability = 8;
Caption = "Oray Display Mirror Driver";
ConfigManagerErrorCode = 0;
ConfigManagerUserConfig = FALSE;
CreationClassName = "Win32_VideoController";
Description = "Oray Display Mirror Driver";
DeviceID = "VideoController2";
DriverDate = "20111026000000.000000-000";
DriverVersion = "1.0.1.17485";
InfFilename = "oem25.inf";
InfSection = "OrayMir_Inst";
Monochrome = FALSE;
Name = "Oray Display Mirror Driver";
PNPDeviceID = "ROOT\\DISPLAY\\0000";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "PC-20190727BPDJ";
VideoArchitecture = 5;
VideoMemoryType = 2;
};



instance of Win32_VideoController
{
AdapterCompatibility = "Famatech";
Availability = 8;
Caption = "Radmin Mirror Driver V3";
ConfigManagerErrorCode = 0;
ConfigManagerUserConfig = FALSE;
CreationClassName = "Win32_VideoController";
Description = "Radmin Mirror Driver V3";
DeviceID = "VideoController3";
DriverDate = "20070808000000.000000-000";
DriverVersion = "3.1.0.0";
InfFilename = "oem31.inf";
InfSection = "mirrorv3";
Monochrome = FALSE;
Name = "Radmin Mirror Driver V3";
PNPDeviceID = "ROOT\\DISPLAY\\0001";
Status = "OK";
SystemCreationClassName = "Win32_ComputerSystem";
SystemName = "PC-20190727BPDJ";
VideoArchitecture = 5;
VideoMemoryType = 2;
};
2588 次点击
所在节点    程序员
7 条回复
ragnaroks
2020-10-20 08:33:37 +08:00
VideoMemoryType == 3
ShuoHui
2020-10-20 08:44:50 +08:00
看着头疼,建议代码下次用 md 包一下🤣
legendnan
2020-10-20 08:45:55 +08:00
@ragnaroks 大佬,我的电脑用的集成的,videoMemoryType 也是 2 呢,这个集成的与远程工具如何区分?
ungrown
2020-10-20 09:17:57 +08:00
wittyfans
2020-10-20 09:34:59 +08:00
用 python 调用 cmd 或者 powershell
ragnaroks
2020-10-20 20:01:47 +08:00
@legendnan 集成显卡借用的系统内存,可以区分独显,不过远程桌面可能要想别的办法
legendnan
2020-11-03 14:45:07 +08:00
有几个人收藏了。。。https://gitee.com/legendnan/py3.4
代码放在了码云上很简单很不完善。。显卡问题目前只使用了主显卡信息。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/716547

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX