from multiprocessing import Process
def GO():
print('Hi\n')
if __name__=='__main__':
pr1 = Process(target=GO)
pr2 = Process(target=GO)
pr1.start()
pr2.start()
pr1.join()
pr2.join()
I made it while looking at the multiprocessing example. Hi is not output at all. What's wrong?
Multi-threads work well, but only multiprocessing works like this.
I think it's a problem with my computer environment because it runs well with a code executor Is there a separate environment where multiprocessing is not possible?
python multiprocessing python3
Not when running interactively, one-by-one.
You must save it as a file (.py) and run it.
© 2024 OneMinuteCode. All rights reserved.