import multiprocessing import sys if getattr(sys, 'frozen', False): # Running as a frozen executable multiprocessing.freeze_support()