问题描述
为什么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了解详情。