p.daemon: True为守护进程, 守护进程内无法再开启子进程,否则抛出异常:AssertionError: daemonic processes are not allowed to have children, 父进程结束则自己也立刻结束; False则为非守护进程, 自身进程运行与父进程是否结束无关; p.daemon = True | False 必须在p.start()之前调用
import time import multiprocessing from multiprocessing import Process def foo(): time.sleep(3) print('this is foo function') if __name__ == '__main__': p = Process(target=foo) p.start() print('Finish')