首页 > 解决方案 > Pyinstaller 没有调用本地钩子

问题描述

在我的目录中,我有两个文件:

print.py,其中包含:

import client 
print('I work')

和 hook-client.py,其中包含:

raise RuntimeError

当我pyinstaller --additional-hooks-dir=. print.py在所述目录中运行时,不会向终端输出回溯/错误消息(挂钩文件出于测试原因引发错误)。

我错过了什么吗?

这是终端中的输出 - 如您所见,没有提及hook-client.py

18 INFO: PyInstaller: 4.0
18 INFO: Python: 3.8.2
24 INFO: Platform: Linux-5.4.0-42-generic-x86_64-with-glibc2.29
24 INFO: wrote /home/riz/Desktop/testing_hook/print.spec
25 INFO: UPX is not available.
26 INFO: Extending PYTHONPATH with paths
['/home/riz/Desktop/testing_hook', '/home/riz/Desktop/testing_hook']
29 INFO: checking Analysis
32 INFO: Building because hookspath changed
32 INFO: Initializing module dependency graph...
33 INFO: Caching module graph hooks...
36 INFO: Analyzing base_library.zip ...
1338 INFO: Processing pre-find module path hook distutils from '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks/pre_find_module_path/hook-distutils.py'.
1338 INFO: distutils: retargeting to non-venv dir '/usr/lib/python3.8'
2631 INFO: Caching module dependency graph...
2689 INFO: running Analysis Analysis-00.toc
2712 INFO: Analyzing /home/riz/Desktop/testing_hook/print.py
2713 INFO: Processing module hooks...
2714 INFO: Loading module hook 'hook-_tkinter.py' from '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2762 INFO: checking Tree
2766 INFO: checking Tree
2768 INFO: Loading module hook 'hook-lib2to3.py' from '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2774 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2774 INFO: Loading module hook 'hook-sysconfig.py' from '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2778 INFO: Loading module hook 'hook-xml.py' from '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2815 INFO: Loading module hook 'hook-distutils.py' from '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2815 INFO: Loading module hook 'hook-encodings.py' from '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2855 INFO: Looking for ctypes DLLs
2872 INFO: Analyzing run-time hooks ...
2874 INFO: Including run-time hook '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth__tkinter.py'
2874 INFO: Including run-time hook '/home/riz/.local/lib/python3.8/site-packages/PyInstaller/hooks/rthooks/pyi_rth_multiprocessing.py'
2878 INFO: Looking for dynamic libraries
3228 INFO: Looking for eggs
3228 INFO: Python library not in binary dependencies. Doing additional searching...
3248 INFO: Using Python library /lib/x86_64-linux-gnu/libpython3.8.so.1.0
3252 INFO: Warnings written to /home/riz/Desktop/testing_hook/build/print/warn-print.txt
3270 INFO: Graph cross-reference written to /home/riz/Desktop/testing_hook/build/print/xref-print.html
3278 INFO: checking PYZ
3280 INFO: Building because toc changed
3280 INFO: Building PYZ (ZlibArchive) /home/riz/Desktop/testing_hook/build/print/PYZ-00.pyz
3551 INFO: Building PYZ (ZlibArchive) /home/riz/Desktop/testing_hook/build/print/PYZ-00.pyz completed successfully.
3553 INFO: checking PKG
3553 INFO: Building because toc changed
3553 INFO: Building PKG (CArchive) PKG-00.pkg
3569 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
3569 INFO: Bootloader /home/riz/.local/lib/python3.8/site-packages/PyInstaller/bootloader/Linux-64bit/run
3569 INFO: checking EXE
3570 INFO: Building because toc changed
3570 INFO: Building EXE from EXE-00.toc
3570 INFO: Appending archive to ELF section in EXE /home/riz/Desktop/testing_hook/build/print/print
3576 INFO: Building EXE from EXE-00.toc completed successfully.
3577 INFO: checking COLLECT
WARNING: The output directory "/home/riz/Desktop/testing_hook/dist/print" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
On your own risk, you can use the option `--noconfirm` to get rid of this question.
6136 INFO: Removing dir /home/riz/Desktop/testing_hook/dist/print
6146 INFO: Building COLLECT COLLECT-00.toc
6179 INFO: Building COLLECT COLLECT-00.toc completed successfully.

标签: python-3.xpyinstaller

解决方案


推荐阅读