我试图将Kivy应用程序编译为Windows exe,但是我一直收到属性错误:AttributeError:'str'对象没有属性'items'
我已经编译了其他应用程序,并按照每条kivy页面的说明行进行操作(完成了演示),但是当我尝试对我的应用程序执行相同操作时,会收到上述错误。我不确定该去哪里了,我已经尝试了几个小时,而且似乎没有任何进展。任何帮助将不胜感激。
编辑:下面是堆栈跟踪的尾部,整个过程很长,因此我粘贴了我认为可能相关的内容,但坦率地说,我在这里有点儿太深了:)
6363 WARNING: stderr: File "c:\python27\lib\site-packages\PyInstaller\depend\a
nalysis.py", line 198, in _safe_import_module
hook_module.pre_safe_import_module(hook_api)
6375 WARNING: stderr: hook_module.pre_safe_import_module(hook_api)
File "c:\python27\lib\site-packages\PyInstaller\hooks\pre_safe_import_module\
hook-six.moves.py", line 55, in pre_safe_import_module
6378 WARNING: stderr: File "c:\python27\lib\site-packages\PyInstaller\hooks\pr
e_safe_import_module\hook-six.moves.py", line 55, in pre_safe_import_module
for real_module_name, six_module_name in real_to_six_module_name.items():
6388 WARNING: stderr: for real_module_name, six_module_name in real_to_six_m
odule_name.items():
AttributeError: 'str' object has no attribute 'items'
6396 WARNING: stderr: AttributeError: 'str' object has no attribute 'items'
我的规格:
# -*- mode: python -*-
from kivy.deps import sdl2, glew
block_cipher = None
a = Analysis(['face.py'],
pathex=['c:\\Users\\Home\\PycharmProjects\\MSICheck\\Images'],
binaries=None,
datas=None,
hiddenimports=['sqlite3','kivy.app','six','packaging','packaging.version','packaging.specifiers'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='face',
debug=True,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,Tree('c:\\Users\\Home\\PycharmProjects\\MSICheck\\Images\\'),
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
strip=False,
upx=True,
name='face')
编辑:显然,它与Kivy无关,因为我已经重写了使用TKinter的前端,但是我仍然遇到问题。
如果您仍然遇到此问题,以下是为我解决的问题:
pip install --upgrade setuptools
我试过安装六个(在我的情况下,尚未安装),但是由于它似乎是在寻找,_vendor.six
而不仅仅是six
,所以并没有解决。以某种方式,升级setuptools可以解决该问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句