Pyinstaller and import issue with wx.lib.pubsub

后端 未结 4 1407
滥情空心
滥情空心 2021-01-06 18:58

My Python GUI app, works perfectly but when I try to create an executable I tried with pyinstaller (3.3.dev0+483c819) command:

pyinstaller gui_app.py
         


        
4条回答
  •  说谎
    说谎 (楼主)
    2021-01-06 19:29

    I ran into the same problem, which is still present after the release of pyinstaller 3.4. This is a known issue when using any of wx.lib.pubsub, PyPubSub, or pypubsub with pyinstaller. See https://github.com/pyinstaller/pyinstaller/issues/1530 ; apparently imports are handled in a way that is tricky to work around. PyPubSub and pypubsub are forks of the same code base, and will have the same problem. If do not want to hack the libs of the wx distribution with every release, your options include:

    • Switch to PyDispatcher, blinker, or another simpler pubsub library
    • Modify PyPubSub so that it loads modules in a way that is compatible with pyinstaller, and submit the PR back to the project

    The path of least resistance seems to be to find a different pubsub library. I switched to blinker, which is minimal and good for smaller projects.

    Another tip: be aware that with pyinstaller there is usually one version combination that is stable, and this varies per-platform.

提交回复
热议问题