为什么 psutil.cpu_count() 在我的 8 核 mac 上显示 16
Why psutil.cpu_count() shows 16 on my 8 core mac
为什么 psutil.cpu_count()
在我的 8 核 mac 上显示 16。我正在使用 Python 3.7.6 和 psutil 5.7.2
那是因为它显示的是逻辑内核(物理内核数乘以每个内核上可以 运行 的线程数)。
如果你只想找出物理核心,那么使用:psutil.cpu_count(logical=False)
在此处阅读文档:https://psutil.readthedocs.io/en/latest/#psutil.cpu_count 了解详细信息。
为什么 psutil.cpu_count()
在我的 8 核 mac 上显示 16。我正在使用 Python 3.7.6 和 psutil 5.7.2
那是因为它显示的是逻辑内核(物理内核数乘以每个内核上可以 运行 的线程数)。
如果你只想找出物理核心,那么使用:psutil.cpu_count(logical=False)
在此处阅读文档:https://psutil.readthedocs.io/en/latest/#psutil.cpu_count 了解详细信息。