import multiprocessing from multiprocessing import Process, Lock, Queue import time import sys; print('Python %s on %s' % (sys.version, sys.platform)) sys.path.extend([r'D:\tuoheng\codenew\update\tuoheng_alg\test\demo\demo6.py']) # Detweights = "/home/th/tuo_heng/dev/AIlib2/weights/river2/yolov5_2080Ti_fp16.engine" # with open(Detweights, "rb") as f: # model = f.read() # Segweights = "/home/th/tuo_heng/dev/AIlib2/weights/river2/stdc_360X640_2080Ti_fp16.engine" # with open(Segweights, "rb") as f: # segmodel = f.read() def add_one(aaa): aaa.put("111111111") aaa.cancel_join_thread() if __name__ == '__main__': aa = Queue() p1 = Process(target=add_one, args=(aa,)) p1.start() time.sleep(2) print(aa.get())