我是靠谱客的博主 甜美小懒虫,这篇文章主要介绍python3打包exe 加密_Pyinstaller加密打包遇到的坑,现在分享给大家,希望可以做个参考。

Pyinstaller加密打包遇到的坑

原来使用Anaconda3-2019.07-Windows-x86_64,Pyinstaller 3.4版本。升级到Anaconda3-2020.02-Windows-x86_64或者Python 3.7.7,使用Pyinstaller进行加密打包成EXE文件,可以成功打包。但是,运行加密的EXE文件,总是报下面错误:

Traceback (most recent call last): File “c:pythonpython37libsite-packagesPyInstallerloaderpyimod03_importers.py”, line 434, in get_code return self._pyz_archive.extract(fullname)[1] File “c:pythonpython37libsite-packagesPyInstallerloaderpyimod02_archive.py”, line 369, in extract obj = zlib.decompress(obj)zlib.error: Error -3 while decompressing data: incorrect header check

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “site-packagesPyInstallerloaderpyiboot01_bootstrap.py”, line 27, in File “c:pythonpython37libsite-packagesPyInstallerloaderpyimod03_importers.py”, line 603, in exec_module bytecode = self.get_code(spec.loader_state) File “c:pythonpython37libsite-packagesPyInstallerloaderpyimod03_importers.py”, line 436, in get_code raise ImportError('Loader FrozenImporter cannot handle module ’ + fullname)ImportError: Loader FrozenImporter cannot handle module os[91896] Failed to execute script pyiboot01_bootstrap

把加密包从PyCryPto更换到PyCryPtoDome,再更换到PyCryPtoDomex,都不能解决。在网上找到很多资料,也没能找到解决方案。后来,在GitHub的Pyinstaller问题列表中,找到了遇到同样问题的人,按其中的解决方法,解决了问题:

https://github.com/pyinstaller/pyinstaller/issues/2247

原来,升级版本后,PyInstaller的版本,安装时,也升级成PyInstaller 3.6。而打包时,没有使用–clean参数,进行清空缓存。更换了PyInstaller版本,第一次打包时,需要增加–clean参数,做一次清空缓存操作:

Pyinstaller --distpath=g:tempdist xxx.spec --clean

原文链接:https://blog.csdn.net/u011195887/article/details/105456945

最后

以上就是甜美小懒虫最近收集整理的关于python3打包exe 加密_Pyinstaller加密打包遇到的坑的全部内容,更多相关python3打包exe内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(64)

评论列表共有 0 条评论

立即
投稿
返回
顶部