I know this has been answered before, but it seems that executing the script directly \"python filename.py\" does not work. I have Python 2.6.2 on SuSE Linux.
Code:<
Restructure your code so that the f() function is defined before you create instance of Pool. Otherwise the worker cannot see your function.
f()
#!/usr/bin/python # -*- coding: utf-8 -*- from multiprocessing import Pool def f(x): return x*x p = Pool(1) p.map(f, [1, 2, 3])