1. 程式人生 > >呼叫os.fork()方法報錯:AttributeError: module 'os' has no attribute 'fork'

呼叫os.fork()方法報錯:AttributeError: module 'os' has no attribute 'fork'

錯誤棧:
Traceback (most recent call last):
File “D:/Users/qc/PycharmProjects/day20/duoxiancheng/duoxiancheng.py”, line 5, in
pid = os.fork()
AttributeError: module ‘os’ has no attribute ‘fork’

原因:windows系統中沒有fork系統呼叫,呼叫os.fork就會報錯,該方法在mac,linux,unix中可以使用