python打包最常用的应该是pyinstaller。

有时候打包时会出现如下报错:

Fatal error: PyInstaller does not include a pre-compiled bootloader for your
platform. For more details and instructions how to build the bootloader see
 

5764 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
5764 INFO: Bootloader c:\users\xxxxxxx\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run_d.exe
5764 INFO: checking EXE
5764 INFO: Building EXE because EXE-00.toc is non existent
5779 INFO: Building EXE from EXE-00.toc

Fatal error: PyInstaller does not include a pre-compiled bootloader for your
platform. For more details and instructions how to build the bootloader see
<https://pyinstaller.readthedocs.io/en/stable/bootloader-building.html>

个人当前使用的是pyinstaller 4.10

将当前版本卸载,重新安装4.9即可打包成功。

也有人解释原因为python的打包引导加载程序问题,下载pyinstaller源码,并从源码安装即可解决。不建议使用pip安装。

-----------------------------------------------

个人体会,并不是pyinstaller代码本身的问题,而是引导加载的问题。

可能是本身环境破坏造成的无法加载,卸载当前版本,并重新安装试下。

-----------------------------------------------

附网络上的两种解决方案:

1

下载pyinstaller并从源代码安装,而不是使用 pip。

python setup.py install

然后,如果您的系统是 64 位,则构建 64 位引导加载程序,尽管 python37-32 需要 32 位引导加载程序。 在源cd bootloader运行python ./waf all --target-arch=32bit解释here

然后将run.exe从 build 文件夹复制到 pyinstaller 32bit bootloader 文件夹。

2

 

首先,确保您运行的是最新版本的 Pyinstaller==3.5。 之前版本的pyinstaller不支持python3.7。

如果没问题,可能是因为 pyinstaller 安装不完整手动检查是否存在用于 pyinstaller 安装的引导加载程序文件。 引导加载程序(预编译)文件应该在你的 python 安装中

c:\users\xxxxxxx\appdata\local\programs\python\python37-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run_d.exe

作为最后的手段,我建议通过 setup.py 安装 pyinstaller。 当您运行 setup.py https://pythonhosted.org/PyInstaller/installation.html#installing-from-the-archive时,它应该为您的机器构建引导加载程序

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐