Answer the question
In order to leave comments, you need to log in
How to make the multiprocessing module work on IPython?
Good day!
I work in IPython, there is a code
from multiprocessing import Pool
import multiprocessing
def job(num):
return num * 2
if __name__=='__main__':
p=Pool(processes=20)
data=p.map(job,range(20))
p.close()
print(data)
Answer the question
In order to leave comments, you need to log in
Unfortunately, your question is not quite complete...
What does "I work in IPython" mean? Is it a notebook, or a console, which one? What versions of all software (Python, IPython / Jupyter)? Operating system?
I tried to run your example in the Qt console, and at the same time I had the system console window open (DOS Prompt on Windows 8), and a long stacktrace fell out into the system window with the following ending:
File "C:\Anaconda3\lib\multiprocessing\queues.py", line 345, in get
return _ForkingPickler.loads(res)
AttributeError: Can't get attribute 'job' on <module '__main__' (built-in)>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question