Can't pickle when using multiprocessing Pool.map()

后端 未结 12 1778
醉梦人生
醉梦人生 2020-11-22 00:19

I\'m trying to use multiprocessing\'s Pool.map() function to divide out work simultaneously. When I use the following code, it works fine:

12条回答
  •  醉酒成梦
    2020-11-22 01:13

    Why not to use separate func?

    def func(*args, **kwargs):
        return inst.method(args, kwargs)
    
    print pool.map(func, arr)
    

提交回复
热议问题