Two pyinstaller problems @ Erwin | 2021-08-24T16:34:01+08:00 | 1 minute read | Update at 2023-12-06T00:27:08Z

Two pyinstaller problems recorded when I first use it.

First problem: DistributionNotFound

Wrap python successfully, but raise pkg_resources.DistributionNotFound error when we run the executable file.

reference https://github.com/pyinstaller/pyinstaller/issues/1713 and https://stackoverflow.com/questions/34775667/pyinstaller-django-pkg-resources-distributionnotfound-the-django-omnibus

Solution:

Create a python file with content like this in the current directory.

from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('prettytable')

Than:

pyinstaller xxx.py --additional-hooks-dir=.

Second problem: Ctrl-C

In my code, Ctrl-C used to break the loop

But after I make executable file by pyinstaller, it performance incorrectly:

Method:

pyinstaller xxx.py --bootloader-ignore-signals

© 2020 - 2024 Li Yuanhao's Blog

Powered by Hugo with theme Dream.

avatar

Li Yuanhao's BlogJust do it

Social Links