Discuss / Python / cmd下执行才行啊,还要再按一次,不知道为什么?

cmd下执行才行啊,还要再按一次,不知道为什么?

Topic source
#多进程.py
from multiprocessing import Process
import os

def run_proc(name):
    print('Parent child process %s (%s)...' % (name, os.getpid()))

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

os.system('pause')

Parent process 8496. Child process will start. 请按任意键继续. . . Parent child process test (9920)... Child process end. 请按任意键继续. . .

手de温度

#2 Created at ... [Delete] [Delete and Lock User]

为什么我启动进程时提示找不到run_proc

手de温度

#3 Created at ... [Delete] [Delete and Lock User]

你是怎么运行这段代码的,是在交互模式下一行行输入的还是怎样的


  • 1

Reply