pyinstaller 如何打包额外的dll等文件

感谢博主:https://blog.csdn.net/xinyingzai/article/details/80282856

详细可跳转上面的链接。

主要是认识pyinstaller里面的的spec文件:

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

block_cipher = None


a = Analysis(['main.py'],
             pathex=['I:\\pyqt5\\video2image_app'],
             binaries=[],
             datas=[("I:/pyqt5/video2image_app/dist/opencv_ffmpeg342_64.dll",'.')],
             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,
          [],
          exclude_binaries=True,
          name='main',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=False )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               upx_exclude=[],
               name='main')

 按照一定的格式,datas=[("I:/pyqt5/video2image_app/dist/opencv_ffmpeg342_64.dll",'.')],增加所需要的dll路径即可。

你可能感兴趣的:(Python)