简体   繁体   English

如何在wxPython中使用cx_freeze?

[英]How to use cx_freeze with wxPython?

I can't get cx_freeze to turn the simplest wxPython app to an .exe file. 我无法让cx_freeze将最简单的wxPython应用程序转换为.exe文件。 I'd like to know how to proceed. 我想知道如何继续。

I'm using Python 3.6.8, wxPython 4.0.4 msw (phoenix) wxWidgets 3.0.5 and Windows 10. I've tried freezing a complex wx App, it did not work so I tried with the simplest app I could think of. 我正在使用Python 3.6.8,wxPython 4.0.4 msw(phoenix)wxWidgets 3.0.5和Windows 10.我已经尝试冻结复杂的wx应用程序,它没有用,所以我尝试了我能想到的最简单的应用程序。

Here's my wx app : 这是我的wx应用程序:

import wx

app = wx.App()
frm = wx.Frame(None, title="Hello World")
frm.Show()
app.MainLoop()

and here's the setup for cx_freeze : 这是cx_freeze的设置:

from cx_Freeze import setup, Executable

build_exe_options = {
    "packages": ["os", "wx"],
    "excludes": ["tkinter"]}

setup(name="simplewxapp",
      version="1",
      description="simplewxapp",
      options={"build_exe": build_exe_options},
      executables=[Executable("simplewxapp.py", base="Win32GUI")])

When I use this command : python setup.py build I expect it to work correctly (as it does when I don't use wxPython). 当我使用这个命令时: python setup.py build我希望它能正常工作(就像我不使用wxPython时那样)。 Instead, I get this error message : 相反,我收到此错误消息:

 File "C:\Program Files\Python36\lib\site-packages\win32\lib\win32verstamp.py", line 159, in stamp
    h = BeginUpdateResource(pathname, 0)
pywintypes.error: (2, 'BeginUpdateResource', 'Le fichier spécifié est introuvable.')

I also tried it with cx freeze the first time. 我第一次尝试使用cx冻结它。 No success on my side as well! 我也没有成功! I use pyinstaller at the moment and after some tweaks it is working perfectly fine. 我现在使用pyinstaller,经过一些调整后,它工作得非常好。

You can find it here: https://www.pyinstaller.org/ 你可以在这里找到它: https//www.pyinstaller.org/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM