1.sepc 文件配置
- Analysis第一个是主文件 如果跟主主文件py不在同一个目录则需要放绝对路径,datas放所用的静态文件 如img 之类的
- pathex,hiddenimports 放项目文件的路径.
3.![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/87aed48b7a19cd3f0a50a507b4639b7b.png)
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['main.py','grabscreen.py','home.py','index.py','jianpan.py','loginView.py','python_trt.py','rec_rc.py','刷图.py','寻路.py','技能.py','model.py'],
pathex=['E:\\yolo\\QT开发 - 副本'],
binaries=[],
datas=[],
hiddenimports=['E:\\yolo\\QT开发 - 副本'],
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='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=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='main')
2 执行打包
pyinstaller -D -w main.py