On Windows all of your multiprocessing
-using code must be guarded by if __name__ == "__main__":
So to be safe, I would put all of your the code currently at the top-level of your script in a main()
function, and then just do this at the top-level:
if __name__ == "__main__":
main()
See the "Safe importing of main module" sub-section here for an explanation of why this is necessary. You probably don't need to call freeze_support
at all, though it won't hurt anything to include it.
Note that it's a best practice to use the if __name__ == "__main__"
guard for scripts anyway, so that code isn't unexpectedly executed if you find you need to import
your script into another script at some point in the future.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…