V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
legendnan
V2EX  ›  程序员

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

  •  1
     
  •   legendnan · 2020-10-20 08:06:22 +08:00 · 2581 次点击
    这是一个创建于 1492 天前的主题,其中的信息可能已经有所发展或是发生改变。
    用 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;
    };
    7 条回复    2020-11-03 14:45:07 +08:00
    ragnaroks
        1
    ragnaroks  
       2020-10-20 08:33:37 +08:00
    VideoMemoryType == 3
    ShuoHui
        2
    ShuoHui  
       2020-10-20 08:44:50 +08:00 via iPhone
    看着头疼,建议代码下次用 md 包一下🤣
    legendnan
        3
    legendnan  
    OP
       2020-10-20 08:45:55 +08:00
    @ragnaroks 大佬,我的电脑用的集成的,videoMemoryType 也是 2 呢,这个集成的与远程工具如何区分?
    ungrown
        4
    ungrown  
       2020-10-20 09:17:57 +08:00
    wittyfans
        5
    wittyfans  
       2020-10-20 09:34:59 +08:00 via iPhone
    用 python 调用 cmd 或者 powershell
    ragnaroks
        6
    ragnaroks  
       2020-10-20 20:01:47 +08:00
    @legendnan 集成显卡借用的系统内存,可以区分独显,不过远程桌面可能要想别的办法
    legendnan
        7
    legendnan  
    OP
       2020-11-03 14:45:07 +08:00
    有几个人收藏了。。。https://gitee.com/legendnan/py3.4
    代码放在了码云上很简单很不完善。。显卡问题目前只使用了主显卡信息。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3180 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 12:35 · PVG 20:35 · LAX 04:35 · JFK 07:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.