1. 程式人生 > >多程序 ImportError: cannot import name Process

多程序 ImportError: cannot import name Process

#coding=utf-8
from multiprocessing import Process
import os


# 子程序要執行的程式碼
def run_proc(name):
    print 'Run child process %s (%s)...' % (name, os.getpid())


if __name__=='__main__':
    print 'Parent process %s.' % os.getpid()
    p = Process(target=run_proc, args=('test',))
    print 'Process will start.'
    p.start()
    p.join()
    print 'Process end.'