最新版的 pyinstaller 有 bug 吗?在打包的时候, pyinstaller/hook 中的 PyQt5 文件一直报错。跪求大神指点! Orz

2019-01-11 11:47:25 +08:00
 520Python
安装方式:
pip3 install pyinstaller
pip3 install PyQt5
版本:
pyinstaller:3.4 ;
pyqt:5.11.3 ;
python:3.6 ;

直接在 pycharm 里面 python 代码运行,功能一切正常; 打包时,报错。

日志如下:
C:\Python36\Scripts\pyinstaller.exe -c -w -i E:\Eric6_Workspace\ID_Number\090105\idNum_main.ico -D E:\Eric6_Workspace\ID_Number\090105\idNum_main.py
546 INFO: PyInstaller: 3.4
546 INFO: Python: 3.6.4
547 INFO: Platform: Windows-10-10.0.14393-SP0
567 INFO: wrote E:\Eric6_Workspace\ID_Number\090105\idNum_main.spec
'upx' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
591 INFO: UPX is not available.
633 INFO: Extending PYTHONPATH with paths
['E:\\Eric6_Workspace\\ID_Number\\090105',
'E:\\Eric6_Workspace\\ID_Number\\090105']
633 INFO: checking Analysis
633 INFO: Building Analysis because Analysis-00.toc is non existent
633 INFO: Initializing module dependency graph...
637 INFO: Initializing module graph hooks...
657 INFO: Analyzing base_library.zip ...
6322 INFO: running Analysis Analysis-00.toc
6387 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\python36\python.exe
7692 INFO: Caching module hooks...
7748 INFO: Analyzing E:\Eric6_Workspace\ID_Number\090105\idNum_main.py
7952 INFO: Loading module hooks...
7952 INFO: Loading module hook "hook-encodings.py"...
8214 INFO: Loading module hook "hook-pydoc.py"...
8215 INFO: Loading module hook "hook-PyQt5.py"...
8457 WARNING: Cannot read QLibraryInfo output: raised Expecting value: line 1 column 1 (char 0) when decoding:

Traceback (most recent call last):
File "C:\Python36\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
File "c:\python36\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python36\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python36\lib\site-packages\PyInstaller\building\build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\python36\lib\site-packages\PyInstaller\building\build_main.py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 17, in <module>
File "c:\python36\lib\site-packages\PyInstaller\building\build_main.py", line 241, in __init__
self.__postinit__()
File "c:\python36\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "c:\python36\lib\site-packages\PyInstaller\building\build_main.py", line 500, in assemble
module_hook.post_graph()
File "c:\python36\lib\site-packages\PyInstaller\building\imphook.py", line 410, in post_graph
self._load_hook_module()
File "c:\python36\lib\site-packages\PyInstaller\building\imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "c:\python36\lib\site-packages\PyInstaller\compat.py", line 736, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\python36\lib\site-packages\PyInstaller\hooks\hook-PyQt5.py", line 23, in <module>
collect_system_data_files(pyqt5_library_info.location['PrefixPath'],
File "c:\python36\lib\site-packages\PyInstaller\utils\hooks\qt.py", line 67, in __getattr__
qli = json.loads(json_str)
File "c:\python36\lib\json\__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "c:\python36\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "c:\python36\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Process finished with exit code 1
3984 次点击
所在节点    Python
3 条回复
520Python
2019-01-11 13:14:31 +08:00
没人遇到过这个问题吗?
whi147
2019-01-12 17:27:34 +08:00
你看下 pyinstaller 和版本是否兼容 Python3.6
520Python
2019-01-13 13:30:55 +08:00
@whi147 感谢,把 python 降至 3.5,就正常了。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/525976

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX