pyinstaller打包多文件夹程序

打包包含多个文件夹的项目
1.pycharm进入该目录
2.pyi-makespec xxxx.py(主程序文件) 生成spec文件
3.修改spec对应的文件
4.pyinstaller xxx.spec 打包该项目

spec文件模板

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


block_cipher = None


a = Analysis(
    ['selenium_merge_requests_v3.py',
    'change_file_v4.py',
    'python_git_v3.py',
    'D:\\pythonProject\\auto_git_tool\\config\\read_my_config.py'],
    pathex=['D:\\pythonProject\\auto_git_tool'],
    binaries=[],
    datas=[('D:\\pythonProject\\auto_git_tool\\config','config'),
    ('C:\\Users\\lw0013789\\AppData\\Local\\pyppeteer\\pyppeteer\\local-chromium\\588429\\chrome-win32','chrome-win32')],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    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='autoGit',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=True,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
coll = COLLECT(
    exe,
    a.binaries,
    a.zipfiles,
    a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='selenium_merge_requests_v3',
)

参考链接:
https://blog.csdn.net/weixin_39531229/article/details/110537890
https://blog.csdn.net/Rebacca122222/article/details/124440089

你可能感兴趣的:(python)