pyinstaller打包的python脚本无法运行

时间:2018-08-20 23:40:07

标签: python python-3.x python-3.6 pyinstaller

用pyinstaller包装了我的python3.6.6脚本,当我尝试从终端运行输出时,没有输出,并且代码立即终止。

当我直接运行脚本时,它具有输出并需要一段时间才能运行。

.spec文件:

# -*- mode: python -*-

block_cipher = None


a = Analysis(['changelog_gen.py'],
             pathex=['/Users/jasonjiang/workspace/utils'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='changelog_gen',
          debug=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='changelog_gen')

在调试模式下运行时的输出:

[25206] PyInstaller Bootloader 3.x
[25206] LOADER: executable is /Users/jasonjiang/workspace/utils/dist/changelog_gen
[25206] LOADER: homepath is /Users/jasonjiang/workspace/utils/dist
[25206] LOADER: _MEIPASS2 is NULL
[25206] LOADER: archivename is /Users/jasonjiang/workspace/utils/dist/changelog_gen
[25206] LOADER: Extracting binaries
[25206] LOADER: Executing self as child
[25206] LOADER: set _MEIPASS2 to /var/folders/0p/xrc4jccj0x3dhdmf1r9zcdkr0000gn/T/_MEI7rvO2g
[25207] PyInstaller Bootloader 3.x
[25207] LOADER: executable is /Users/jasonjiang/workspace/utils/dist/changelog_gen
[25207] LOADER: homepath is /Users/jasonjiang/workspace/utils/dist
[25207] LOADER: _MEIPASS2 is /var/folders/0p/xrc4jccj0x3dhdmf1r9zcdkr0000gn/T/_MEI7rvO2g
[25207] LOADER: archivename is /Users/jasonjiang/workspace/utils/dist/changelog_gen
[25207] LOADER: Already in the child - running user's code.
[25207] LOADER: Python library: /var/folders/0p/xrc4jccj0x3dhdmf1r9zcdkr0000gn/T/_MEI7rvO2g/Python
[25207] LOADER: Loaded functions from Python library.
[25207] LOADER: Manipulating environment (sys.path, sys.prefix)
[25207] LOADER: Pre-init sys.path is /var/folders/0p/xrc4jccj0x3dhdmf1r9zcdkr0000gn/T/_MEI7rvO2g/base_library.zip:/var/folders/0p/xrc4jccj0x3dhdmf1r9zcdkr0000gn/T/_MEI7rvO2g
[25207] LOADER: sys.prefix is /var/folders/0p/xrc4jccj0x3dhdmf1r9zcdkr0000gn/T/_MEI7rvO2g
[25207] LOADER: Setting runtime options
[25207] LOADER: Initializing python
[25207] LOADER: Overriding Python's sys.path
[25207] LOADER: Post-init sys.path is /var/folders/0p/xrc4jccj0x3dhdmf1r9zcdkr0000gn/T/_MEI7rvO2g/base_library.zip:/var/folders/0p/xrc4jccj0x3dhdmf1r9zcdkr0000gn/T/_MEI7rvO2g
[25207] LOADER: Setting sys.argv
[25207] LOADER: setting sys._MEIPASS
[25207] LOADER: importing modules from CArchive
[25207] LOADER: extracted struct
[25207] LOADER: callfunction returned...
[25207] LOADER: extracted pyimod01_os_path
[25207] LOADER: callfunction returned...
[25207] LOADER: extracted pyimod02_archive
[25207] LOADER: callfunction returned...
[25207] LOADER: extracted pyimod03_importers
[25207] LOADER: callfunction returned...
[25207] LOADER: Installing PYZ archive with Python modules.
[25207] LOADER: PYZ archive: out00-PYZ.pyz
[25207] LOADER: Running pyiboot01_bootstrap.py
[25207] LOADER: Running pyi_rth_multiprocessing.py
[25207] LOADER: Running pyi_rth_pkgres.py
[25207] LOADER: Running changelog_gen.py
[25207] LOADER: OK.
[25207] LOADER: Cleaning up Python interpreter.
[25206] LOADER: Back to parent (RC: 0)
[25206] LOADER: Doing cleanup
[25206] LOADER: Freeing archive status for /Users/jasonjiang/workspace/utils/dist/changelog_gen

0 个答案:

没有答案