from subprocess import Popen, CREATE_NEW_CONSOLE import sys executable_path = sys.executable if __name__ == '__main__': # 通过终端生成多个用户进程,监听队列消息 for i in range(10): Popen([executable_path, "test_many_user.py", "{0}".format(i+1)], creationflags=CREATE_NEW_CONSOLE)