我知道os.nice()它非常适合父进程,但我需要对我的子进程做一些改进。我找到了这样做的方法,但它似乎不是很方便而且太过分了:os.system("renice-n%d%d"%(new_nice,suprocess.pid))并且在renicing后它不会返回结果良好的水平。在python中有没有更干净的方法来重新定义子进程? 最佳答案 使用subprocess.Popen的preexec_fn参数:Ifpreexec_fnissettoacallableobject,thisobjectwillbecalledinthechil