`

python 多进程并行

 
阅读更多

>>> from multiprocessing import Pool

>>> p = Pool(5)

>>> def f(x):

...     return x*x

...

>>> p.map(f, [1,2,3])

Process PoolWorker-1:

Process PoolWorker-2:

Process PoolWorker-3:

Traceback (most recent call last):

AttributeError: 'module' object has no attribute 'f'

AttributeError: 'module' object has no attribute 'f'

AttributeError: 'module' object has no attribute 'f'

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics