系统相关
首页 > 系统相关> > python多进程 pyinstaller打包后一直无限增加进程,但并不执行,导致死机

python多进程 pyinstaller打包后一直无限增加进程,但并不执行,导致死机

作者:互联网

import multiprocessing
from multiprocessing import Process,Lock,Manager
from multiprocessing import Queue
from multiprocessing import JoinableQueue
#多进程程序用pyinstaller打包一味地增加进程,但不进行的解决方法
#解决思路:multiprocessing.freeze_support()必须写在主程序的第一行
if __name__=='__main__':
    multiprocessing.freeze_support()
    global con,connect
    multiprocessing.Process()
    connect = pymysql.connect(user = 'm',
                password = 'h',
                db = 'x',
                host = 'r',
                port = 3306,
                charset = 'utf8'
                )
    con = connect.cursor()
    pw = Process(target=newlbjs, args=())
    pr = Process(target=gxye, args=())
    pr1 = Process(target=gxye, args=())
    pr1.start()
    pw.start()
    pr.start()
    pw.join()
    pr.join()
    pr1.join()
    #newlbjs()

 

标签:__,pr,pyinstaller,Process,死机,connect,进程,import,multiprocessing
来源: https://www.cnblogs.com/xkdn/p/16085064.html