我的 Python GUI 应用程序运行良好,但是当我尝试创建可执行文件时,我尝试使用 pyinstaller (3.3.dev0+483c819) 命令:
pyinstaller gui_app.py
我收到以下问题:
7699 INFO: Loading module hook "hook-wx.lib.pubsub.py"...
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 36, in walk_packages
File "<string>", line 20, in walk_packages
File "c:\python27\lib\site-packages\wx-3.0-msw\wx\lib\pubsub\core\arg1\__init__.py", line 16, in <module>
raise RuntimeError(msg)
RuntimeError: Should not import this directly, used by pubsub.core if applicable
8006 WARNING: Hidden import "wx.lib.pubsub.core.publisher" not found!
8008 WARNING: Hidden import "wx.lib.pubsub.core.listenerimpl" not found!
8009 WARNING: Hidden import "wx.lib.pubsub.core.publishermixin" not found!
8009 WARNING: Hidden import "wx.lib.pubsub.core.datamsg" not found!
8009 WARNING: Hidden import "wx.lib.pubsub.core.topicargspecimpl" not found!
8009 WARNING: Hidden import "wx.lib.pubsub.core.topicmgrimpl" not found!
可执行文件已“成功”创建,但是当我启动它时,出现以下错误:
Traceback (most recent call last):
File "upload_test_run_dynamic_clean.py", line 21, in <module>
from wx.lib.pubsub import pub
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\wx-3.0-msw\wx\lib\pubsub\pub.py", line 35, in <module>
File "c:\python27\Lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\wx-3.0-msw\wx\lib\pubsub\core\__init__.py", line 45, in <module>
ImportError: No module named publisher
我尝试添加 hookspath 是规范文件(它在 pyinstaller hooks 文件夹中已经存在 wx.lib.pubsub 的挂钩)但它不起作用,或者我做错了什么。
是否有导入 wx 和其他子模块的命令。我的代码中有这个
import wx
import wx.lib.pubsub.setuparg1
from wx.lib.pubsub import pub
import wx.lib.agw.pybusyinfo as PBI
from wx.lib.scrolledpanel import ScrolledPanel