Error when profiling an otherwise perfectly working multiprocessing python script with cProfile
问题 I've written a small python script that uses multiprocessing (See https://stackoverflow.com/a/41875711/1878788). It works when I test it: $ ./forkiter.py 0 1 2 3 4 sum of x+1: 15 sum of 2*x: 20 sum of x*x: 30 But when I try to profile it with cProfile , I get the following: $ python3.6 -m cProfile -o forkiter.prof ./forkiter.py 0 1 2 3 4 Traceback (most recent call last): File "/home/bli/lib/python3.6/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/home/bli/lib