1. 当前位置:网站首页 > Python

多进程程序使用Pyinstaller打包注意事项


打包时的注意事项

打包时使用共享元组,会一直创建最后系统崩溃的bug

打包时多进程服务会自动启动另一个窗体的bug

  • 使用multiprocessing.freeze_support()添加至main方法下第一行解决该问题,如下示例
if __name__ == '__main__':
    # 解决打包不允许执行多进程的bug
    multiprocessing.freeze_support()
    app = QApplication(sys.argv)
    loading = QMovie("./static/loading.gif")
    splash = MovieSplashScreen(loading)
    splash.show()
    # 打包存在bug
    share_memory = Manager()
    RESULT_FILTER = share_memory.dict()
    start = time.time()
    while loading.state() == QMovie.Running and time.time() < start + 1:
        app.processEvents()
    windows = AppMain()
    # 启动异步队列接收UDP返回的数据
    receive = GetData()
    receive.data_Signal.connect(windows.receive)
    receive.start()
    windows.show()
    splash.finish(windows)
    app.exec()

本文最后更新于2023-5-24,已超过 3个月没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
版权说明

本文地址:http://www.liuyangdeboke.cn/?post=44
未标注转载均为本站远程,转载请注明文章出处:

发表评论

联系我们

在线咨询:点击这里给我发消息

微信号:17721538135

工作日:9:00-23:00,节假日休息

扫码关注