Reputation: 121
I was trying out multiprocessing because I was trying to imitate an internet and how it's nodes work. I am fine with the basic functionality so I looked on the documentation and used the most basic example on the 3.7.0 documentation, the version I am using now. To my surprise, it didn't work. I am using a Mac OS High Sierra, version 10.13.6, if it has to do with anything. Here is the code for clarity:
from multiprocessing import Pool
def f(x):
return x*x
if __name__ == '__main__':
with Pool(5) as p:
print(p.map(f, [1, 2, 3]))
I was wondering why it didn't work, as it didn't show anything, and would want the working version, thank you.
Upvotes: 2
Views: 2058
Reputation: 11
pip install multiprocess
from multiprocess import Pool
I used multiprocessing
package like most people, but it didn't work. So I tried multiprocess
package, and it worked well.
Upvotes: 1
Reputation: 629
For me, the issue was using:
random.seed = <SOME INT>
along with any form of multiprocessing.
Upvotes: 0
Reputation: 7343
The screenshot indicates that you've opened up your interpreter for some reason.
Run your file like so: python3 main.py
Upvotes: 0