meikkiie 发表于 2017-5-1 06:18:29

python 多进程并行

  >>> from multiprocessing import Pool
  >>> p = Pool(5)
  >>> def f(x):
  ...     return x*x
  ...
  >>> p.map(f, )
  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'
页: [1]
查看完整版本: python 多进程并行