Using the platform module in Python on my Windows laptop, I get the following output
import platform
platform.processor()
Run Code Online (Sandbox Code Playgroud)
'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?
如果您可以使用库(从Gettingprocessor information in Python复制答案)
您可以使用
cpuinfo。安装为
pip install py-cpuinfo从命令行使用:
python -m cpuinfo代码:
Run Code Online (Sandbox Code Playgroud)import cpuinfo cpuinfo.get_cpu_info()['brand_raw']
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
Run Code Online (Sandbox Code Playgroud)
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
| 归档时间: |
|
| 查看次数: |
3320 次 |
| 最近记录: |