我試圖檢查在Why does multiprocessing use only a single core after I import numpy?建議我的劇本與「os.sched_getaffinity」方法使用的核心數量。但是,當我運行的Python 3.6.0:「操作系統」模塊沒有「sched_getaffinity」的方法
import os
os.sched_getaffinity(0)
我得到
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'
這是怎麼回事錯在這裏? 'os'模塊的其他標準方法似乎可行。我使用Python 3.6.0運行Anaconda 4.3.0。我嘗試了Mac和Linux。任何替代方法來檢查和更改任務親和力?
你叫一個文件'os.py'或文件夾'os'? – user2357112
如果你能爲你提供完整的回溯Python的版畫,它會更容易爲人們提供幫助。你可能只是掩蓋'os'爲user2357112說,回溯會驗證它。 –
感謝您的反饋,我編輯的問題。 – Aki