gpt4 book ai didi

python - 在 python 2.7 中获取唯一的机器 ID

转载 作者:太空宇宙 更新时间:2023-11-04 09:26:30 26 4
gpt4 key购买 nike

import pycpuid    
b=pycpuid.cpuid(1)
pid=str(b[0]+b[3])

每次系统重启都一样吗?不确定传递不同的整数对 cpuid 函数有什么影响?即:无论安装什么操作系统或该操作系统的版本,或网络适配器......如果运行 python 并使用此函数,它将始终返回相同的值这就是我要找的,基于 CPU,没有其他硬件

最佳答案

CPUID call对于特定计算机,它不会是唯一的(但它也不会改变 - 因此它在操作系统之间是相同的(它是处理器中实现的操作码))。只有a subset of processors (in the Pentium 3 range for Intel and a few other brands)返回一个实际的序列号。 AMD 不会返回任何版本的序列号。

cpuid 的整数告诉它 what information it should retrieve - see the EAX column in the documentation for the opcode - 即它是否应该返回对某个功能的特定检查。您不必直接调用它,而是使用 pycpuid 中定义的辅助函数(它根据应检索的内容提供参数)。

如果您使用参数1 调用cpuinfo,那么您是asking it to return the information given当 EAX 为 1 时:

INPUT EAX = 1: Returns Model, Family, Stepping Information When CPUID executes with EAX set to 1, version information is returned in EAX.

INPUT EAX = 1: Returns Additional Information in EBX

When CPUID executes with EAX set to 1, additional information is returned to the EBX register: - Brand index (low byte of EBX) - this number provides an entry into a brand string table that contains brand strings for IA-32 processors. More information about this field is provided later in this section.

CLFLUSH instruction cache line size (second byte of EBX) this number indicates the size of the cache line flushed with CLFLUSH instruction in 8-byte increments. This field was introduced in the Pentium 4 processor.

Local APIC ID (high byte of EBX) this number is the 8-bit ID that is assigned to the local APIC on the processor during power up. This field was introduced in the Pentium 4 processor.

关于python - 在 python 2.7 中获取唯一的机器 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57384661/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com