【问题标题】:auto-py-to-exe generated 2 error messages: `UPX is not available` and `an error occurred while packaging`auto-py-to-exe 生成 2 条错误消息:“UPX 不可用”和“打包时出错”
【发布时间】:2021-04-20 03:50:51
【问题描述】:

我正在尝试将我的 .py 转换为 .exe
但是,使用 auto-py-to-exe 时出现 2 条错误消息。第一条错误信息如下:

UPX is not available.

第二条错误信息如下:

An error occurred while packaging.

第二条消息导致“项目输出将不会移动到输出文件夹。
相关错误:

    266710 INFO: PyInstaller: 5.0.dev0
    266725 INFO: Python: 3.9.1
    266746 INFO: Platform: Windows-10-10.0.19041-SP0
    266765 INFO: wrote C:\Users\Public\Documents\ESTsoft\CreatorTemp\tmpgijz11tp\Seming Teacher's Reading Master.spec
    266784 INFO: UPX is not available.
    An error occurred while packaging
    Traceback (most recent call last):
      File "c:\users\user\appdata\local\programs\python\python39\lib\site-packages\auto_py_to_exe\packaging.py", line 131, in package
        run_pyinstaller()
      File "c:\users\user\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 114, in run
        run_build(pyi_config, spec_file, **vars(args))
      File "c:\users\user\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
        PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
      File "c:\users\user\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main
        build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
      File "c:\users\user\appdata\local\programs\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 669, in build
        code = compile(f.read(), spec, 'exec')
      File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\tmpgijz11tp\Seming Teacher's Reading Master.spec", line 26
        name='Seming Teacher's Reading Master',
                             ^
    SyntaxError: invalid syntax

Project output will not be moved to output folder.

【问题讨论】:

    标签: python python-3.x pyinstaller exe upx


    【解决方案1】:

    UPX 用于进一步压缩您的 exe,是可选的

    一个压缩的可执行程序被封装在 UPX 启动代码中,该代码在程序启动时动态解压缩程序。

    有关更多信息,请参阅this

    但是如果你不关心这个,那么在你的命令中添加--noupx标志,这将明确告诉pyinstaller不要使用它

    现在,对于第二个错误,它是由于您的 python 文件中的语法错误引起的,如下所示

    name='Seming Teacher's Reading Master'
    

    您需要对整个字符串使用更高的引号,因为您将单引号作为字符串的一部分,请将其更改为类似

    name="Seming Teacher's Reading Master"
    

    这应该可以消除错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-08-16
      • 2021-11-04
      • 2021-06-05
      • 1970-01-01
      • 2022-09-23
      • 1970-01-01
      • 2021-06-14
      • 1970-01-01
      相关资源
      最近更新 更多