我使用 py2exe 从我的 .py 成功创建了一个 .exe。但是当我尝试从 exe 运行应用程序时,我收到以下错误消息:
Traceback (most recent call last):
File "StreetSoccer.py", line 13, in <module>
ImportError: cannot import name Publisher
我已经找到了这个页面:ImportError: cannot import name Publisher but I'm using python2.7. 这是我导入 Publisher 的 .py 行:
from wx.lib.pubsub import Publisher
希望您能够帮助我。
编辑:我做了这些改变:
# from wx.lib.pubsub import Publisher
from wx.lib.pubsub import setupv1
from wx.lib.pubsub import pub
Publisher = pub.Publisher()
现在我收到此错误消息(在 py2exe 之后):
File "StreetSoccer.py", line 14, in <module>
File "wx\lib\pubsub\setupv1.pyc", line 16, in setVersion
File "wx\lib\pubsub\pubsubconf.pyc", line 16, in setVersion
File "wx\lib\pubsub\pubsubconf.pyc", line 70, in setVersion
File "wx\lib\pubsub\pubsubconf.pyc", line 78, in __setupForV1
File "wx\lib\pubsub\pub.pyc", line 24, in <module>
File "wx\lib\pubsub\core\listener.pyc", line 13, in <module>
Import Error: No module named listenerimpl