使用Py2exe创建exe后出错

发布于 2024-10-05 17:26:09 字数 2006 浏览 5 评论 0原文

Py2exe 似乎运行良好,尽管它确实提到可能缺少一些模块。

我一直在使用 windows 选项(在我的 py2exe 脚本中)来删除控制台窗口,但意识到即使在我关闭 gui 窗口后,该进程仍然保持打开状态,即我仍然可以看到该进程仍在任务管理器中......所以我切换到使用控制台选项,发现那里打印出以下错误。我相信此错误导致应用程序无法关闭。除此之外,该应用程序运行良好。

Iv 尝试从一个非常简单的 wxPython GUI 应用程序创建一个 exe,但即便如此,我仍然收到此错误,但是我从不包含 wxPython 的应用程序创建可执行文件没有问题。

Debug: src/helpers.cpp(140): 'createActCtx' failed with error 0x0000007b (the filename, directory name, or volume label syntax is incorrect.).)

替代文字

Python:2.6.6

wxPython:2.8.11.0

Windows 7

py2exe:0.6.9

# -*- coding: utf-8 -*-


from distutils.core import setup
import py2exe
import glob



excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
            'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
            'Tkconstants', 'Tkinter']

dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll',]#'msvcp90.dll']

packages = []#'wx.lib.pubsub']


data_files = [("resources", ['resources/1187958_90214884.jpg'])]
packages = ['wx.lib.pubsub',]
options = {'py2exe': {'compressed': 3,
                          'optimize': 2,
                          'excludes': excludes,
                          'packages': packages,
                          'dll_excludes': dll_excludes,
                          'bundle_files': 1,
                          'dist_dir': 'dist',
                          'xref': False,
                          'skip_archive': False,
                          'ascii': False,
                          'packages': packages,
                        'custom_boot_script': '',
                         }
                }  

#windows=[{'script':'gui.py'}]


for script in ["gui.py"]:
    windows=[{
        'script':[script]
    }]

    setup(options=options, console=[script], zipfile=None, data_files=data_files)                        

Py2exe seems to run fine although it does mention that a few modules maybe missing.

I had been using the windows option (in my py2exe script) to remove the console window but realized that the process still remained open even after I closed down the gui window i.e. I could still see the process still in task manager... So I switched to using the console option and found the below error printed there. I believe this error is preventing the the app from closing. Apart from that the app runs fine.

Iv tried creating an exe from a very simple wxPython GUI app but even then I still get this error however I have no problem creating executables from apps that do not include wxPython.

Debug: src/helpers.cpp(140): 'createActCtx' failed with error 0x0000007b (the filename, directory name, or volume label syntax is incorrect.).)

alt text

Python: 2.6.6

wxPython: 2.8.11.0

Windows 7

py2exe: 0.6.9

# -*- coding: utf-8 -*-


from distutils.core import setup
import py2exe
import glob



excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
            'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
            'Tkconstants', 'Tkinter']

dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll', 'tk84.dll',]#'msvcp90.dll']

packages = []#'wx.lib.pubsub']


data_files = [("resources", ['resources/1187958_90214884.jpg'])]
packages = ['wx.lib.pubsub',]
options = {'py2exe': {'compressed': 3,
                          'optimize': 2,
                          'excludes': excludes,
                          'packages': packages,
                          'dll_excludes': dll_excludes,
                          'bundle_files': 1,
                          'dist_dir': 'dist',
                          'xref': False,
                          'skip_archive': False,
                          'ascii': False,
                          'packages': packages,
                        'custom_boot_script': '',
                         }
                }  

#windows=[{'script':'gui.py'}]


for script in ["gui.py"]:
    windows=[{
        'script':[script]
    }]

    setup(options=options, console=[script], zipfile=None, data_files=data_files)                        

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮云落日 2024-10-12 17:26:09

我在使用 py2exe 将 wxPython 代码编译为 exe 时遇到了很少的麻烦。我有一个教程,您可以在这里尝试:

http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/

我在使用新版本时遇到了一些问题2.8.11.0 中包含的 pubsub。您可以在此处阅读该帖子:http://bit.ly/emoHEr

我最终恢复到了以前的版本那天wx主要是因为我没有时间去弄清楚我做错了什么。我不知道这是否是您遇到的问题。

I've had very little trouble getting wxPython code to compile to an exe using py2exe. I have a tutorial that you can try here:

http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/

I have had some issues with the new version of pubsub that is included with 2.8.11.0. You can read the thread here: http://bit.ly/emoHEr

I ended up reverting to the previous version of wx that day mainly because I didn't have time to figure out what I was doing wrong. I don't know if that's the problem that you're having though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文