代码之家  ›  专栏  ›  技术社区  ›  Carlo Bianchi

正在转换。py到。exe使用Python 3.5/3.6?

  •  1
  • Carlo Bianchi  · 技术社区  · 7 年前

    我设法用py2app在Mac上打包了它。我正试图在Windows上做同样的事情。我试着使用 this guide 据我所知,我有3种选择:

    1. py2exe
    2. cx_冻结

    1) py2exe

    here py2exe仍然不能用于python3.6,那么我需要使用python3.5。

    使用3.5,我得到了这个错误,编译停止:

    error: [Errno 2] No such file or directory: 'C:\\Users\\carlo\\AppData\\Roaming\\Python\\Python35\\site-packages\\py2exe\\run-py3.5-win32.exe'
    

    通过Python3.5运行pyinstaller: pyinstaller --onefile APP.py

    我只收到了一堆警告(lib未找到),但编译到此结束。但是,创建的EXE会打开命令提示符并弹出以下错误:

       Traceback (most recent call last):
      File "site-packages\PyInstaller\loader\rthooks\pyi_rth_qt5plugins.py", line 46, in <module>
      File "c:\program files (x86)\python35-32\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 573, in load_module
        module = loader.load_module(fullname)
    ImportError: DLL load failed: %1 is not a valid Win32 application.
    Failed to execute script pyi_rth_qt5plugins
    

    使用python3.5,它首先给出“TCL\u LIBRARY”错误。遵循说明 here 使用python3.6,编译似乎还可以。当我试图打开应用程序时,会弹出这个错误。我只是想快点 screen-shot:

    1 回复  |  直到 7 年前
        1
  •  0
  •   Carlo Bianchi    7 年前

    我按照指示做了 here 我第一次跑步(使用Python3.5):

    pyinstaller CodeName.py

    然后我修改了。规范文件,如 link