为什么 pyinstaller 创建的可执行文件不起作用?

时间:2021-06-22 13:26:51

标签: python pyinstaller

使用 pyinstaller 创建了一个可执行文件。 它因以下错误而崩溃

Failed to extract ..\init_data\*\Readme.txt: failed to open target file!
fopen: Invalid argument

原始目录结构中没有Readme.txt。那么为什么会失败?

命令行是

pyinstaller -F --add-data "<path_to>\Pack_Movements\*;<path_to>\Pack_Movements\datacreationScripts\utilities\init_data\*" main.py

.spec 内容如下

# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['main.py'],
             pathex=['<path_to>\\Desktop\\test\\Pack_Movements'],
             binaries=[],
             datas=[('<path_to>\\Desktop\\test\\Pack_Movements\\*', '<path_to>\\Desktop\\test\\Pack_Movements\\datacreationScripts\\utilities\\init_data\\*')],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name='main',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=True )

.spec 中提到的路径与命令行参数中给出的路径完全相同。

0 个答案:

没有答案
相关问题