1
from multiprocessing import Process
import sys
def f(name):
print('hello', name)
if __name__ == '__main__':
p = Process(target=f, args=('bob',))
p.start()
p.join()
print(p,type(p))
该程序没有在我的电脑正常运行......但它工作正常使用在线编译multiprocessing.Process工作不正常
====================== RESTART: E:\Python\py_prac_9.py ======================
<Process(Process-1, stopped[1])> <class 'multiprocessing.context.Process'>
>>>
预期输出:
====================== RESTART: E:\Python\py_prac_9.py ======================
hello bob
<Process(Process-1, stopped[1])> <class 'multiprocessing.context.Process'>
>>>
我使用Windows 8.1的3.5.4 python版本...
Environmental Variables:
PATH:
C:\Users\Madhu G\AppData\Local\Programs\Python\Python35-32\;
C:\Users\Madhu G\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\;
C:\Users\Madhu G\AppData\Local\Programs\Python\Python35-32\Scripts\;
请建议我的解决方案,即使守护进程没有执行正确的...我是否需要在我的电脑做任何更改..
即使守护进程线程也没有正确执行...... – Madhu
在我的PC(Windows 7)上用Python 2.7.12和3.5.2都能正常工作。你如何执行脚本? – martineau
这里有一个错字:'args =('bob',))''。 –