其他分享
首页 > 其他分享> > pyinstaller添加外部文件打包出错(for src_root_path_or_glob, trg_root_dir in binaries_or_datas: ValueError: too

pyinstaller添加外部文件打包出错(for src_root_path_or_glob, trg_root_dir in binaries_or_datas: ValueError: too

作者:互联网

for src_root_path_or_glob, trg_root_dir in binaries_or_datas:
ValueError: too many values to unpack (expected 2)

 

打包时出错。大概率问题出在  编辑spec文件时出错。

a = Analysis(['kaishi.py'],
             pathex=[],
             binaries=[],
             datas=[('1.jpg)],
             hiddenimports=[],
             hookspath=[],
             hooksconfig={},
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)

问题出在 

datas=[('1.jpg)],

这个打包限制,最起码两个以上打包,所以要改写代码。

datas=[('1.jpg','.')],

这样就可以成功打包。也可以加点其他附加东西。 最终就这样。

a = Analysis(['kaishi.py'],
             pathex=[],
             binaries=[],
             datas=[('1.jpg','.')],
             hiddenimports=[],
             hookspath=[],
             hooksconfig={},
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)

可以成功打包了。 前提是修改了spec  datas属性打包失败的解决办法。

1639 INFO: Updating resource type 24 name 1 language 0
1646 INFO: Appending PKG archive to EXE
1963 INFO: Building EXE from EXE-00.toc completed successfully.
1967 INFO: checking COLLECT
1968 INFO: Building COLLECT because COLLECT-00.toc is non existent
1968 INFO: Building COLLECT COLLECT-00.toc
2190 INFO: Building COLLECT COLLECT-00.toc completed successfully.

 

标签:INFO,src,pyinstaller,COLLECT,打包,Building,False,root,datas
来源: https://www.cnblogs.com/aotumandaren/p/15770604.html