从Python查询CPU ID? [英] Query CPU ID from Python?

查看:329
本文介绍了从Python查询CPU ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在py2.6,Windows OS中找到处理器ID?

How I can find processor id with py2.6, windows OS?

我知道有pycpuid,但我无法在2.6下编译它。 / p>

I know that there is pycpuid, but I can't compile this under 2.6.

推荐答案

您是否尝试过 wmi ? (可能需要更高的特权级别)

Have you tried wmi? (It may require elevated privilege level)

这是一个解决方案(适用于Python 2和3):

Here's a solution (it works for Python 2 and 3):

>>> import wmi
>>> c = wmi.WMI()
>>> for s in c.Win32_Processor():
    print (s)



instance of Win32_Processor
{
    AddressWidth = 64;
    Architecture = 9;
    Availability = 3;
    Caption = "Intel64 Family 6 Model 26 Stepping 5";
    CpuStatus = 1;
    CreationClassName = "Win32_Processor";
    CurrentClockSpeed = 3068;
    DataWidth = 64;
    Description = "Intel64 Family 6 Model 26 Stepping 5";
    DeviceID = "CPU0";
    ExtClock = 133;
    Family = 1;
    L2CacheSize = 1024;
    L3CacheSize = 8192;
    L3CacheSpeed = 0;
    Level = 6;
    LoadPercentage = 3;
    Manufacturer = "GenuineIntel";
    MaxClockSpeed = 3068;
    Name = "Intel(R) Core(TM) i7 CPU         950  @ 3.07GHz";
    NumberOfCores = 4;
    NumberOfLogicalProcessors = 8;
    PowerManagementSupported = FALSE;
    ProcessorId = "BFEBFBFF000106A5";
    ProcessorType = 3;
    Revision = 6661;
    Role = "CPU";
    SocketDesignation = "CPU 1";
    Status = "OK";
    StatusInfo = 3;
    SystemCreationClassName = "Win32_ComputerSystem";
    SystemName = "RYAN-PC";
    UpgradeMethod = 1;
    Version = "";
    VoltageCaps = 0;
};

这篇关于从Python查询CPU ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆