5

Using the platform module in Python on my Windows laptop, I get the following output

import platform
platform.processor()

'Intel64 Family 6 Model 58 Stepping 9, GenuineIntel'

If I look at the Windows System Information, however, I am told that my processor is an Intel Core i5-3317U CPU at 1.70Ghz. How can I get Python to return processor information in this format?

2 Answers 2

8

If you are ok with using libraries (copied answer from Getting processor information in Python)

you can use cpuinfo.

Install as pip install py-cpuinfo

Use from the commandline: python -m cpuinfo

Code:

import cpuinfo
cpuinfo.get_cpu_info()['brand_raw']
Sign up to request clarification or add additional context in comments.

2 Comments

For me, the returned dict has no brand key, only brand_raw but it works equally well for me.
@mxmlnkn : thanks, it seems to have changed indeed
4

With some com interface through pywin32 you can:

def get_cpu_type():
    from win32com.client import GetObject
    root_winmgmts = GetObject("winmgmts:root\cimv2")
    cpus = root_winmgmts.ExecQuery("Select * from Win32_Processor")
    return cpus[0].Name

The result on my machine:

Intel(R) Xeon(R) CPU W3550 @ 3.07GHz

You can also get all sorts of info on the CPUs this way. See this MSDN article

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.