我正在尝试按照'os.sched_getaffinity'方法检查我的脚本正在使用的内核数,如导入numpy后为什么多处理仅使用单个内核一样?。但是当我跑步时
import os
os.sched_getaffinity(0)
Run Code Online (Sandbox Code Playgroud)
我懂了
AttributeError
Traceback (most recent call last) <ipython-input-1-895d9c252fd1> in <module>()
1 import os
----> 2 os.sched_getaffinity(0)
AttributeError: module 'os' has no attribute 'sched_getaffinity'
Run Code Online (Sandbox Code Playgroud)
这是怎么了?来自“ os”模块的其他标准方法似乎可行。我正在使用Python 3.6.0运行Anaconda 4.3.0。我在Mac和Linux上都尝试过。还有其他检查和更改任务关联性的方法吗?