2.修改.spec⽂件以导⼊其他⽂件未修改的.spec⽂件内容如下:
a =Analysis([video_test.py'],
pathex=['D:\\Python37\\FCN-DenseNet-master-1'],
binaries=[],
datas=[],
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='video_test',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
主程序调⽤了跟主程序同⼀⽬录下的model.py和densenet.py,以及模型⽂件,存放主程序所需模型⽂件的⽂件夹为parameters_densenet121,于是修改后如下:
a =Analysis(['video_test.py'],
pathex=['D:\\Python37\\FCN-DenseNet-master-1'],
binaries=[],
datas=[('parameters_densenet121','parameters_densenet121')],            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,
cipher命令
[],
name='video_test',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
修改后在路径下输⼊命令:
pyinstaller video_test.spec
3.运⾏.exe⽂件
双击dist⽂件夹下video_test⽂件夹⾥的.exe⽂件

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。