没有 PyInstaller 生成的钩子文件

No hook files generated by PyInstaller

在 PyInstaller documentation 中声明如下:

The name of a hook file is hook-full.import.name.py, where full.import.name is the fully-qualified name of an imported script or module. You can browse through the existing hooks in the hooks folder of the PyInstaller distribution folder and see the names of the packages for which hooks have been written.

然而,在我 为我的脚本生成可执行文件时,在 运行 之后,我发现在生成的 dist 文件夹中没有 hooks 文件夹。

我找错文件夹了吗?我的钩子文件被转储到哪里了?

文档状态

You can browse through the existing hooks in the hooks folder of the PyInstaller distribution folder

而不是

You can browse through the existing hooks in the hooks folder of the distribution folder

这意味着您不能指望在 运行

生成的 dist 文件夹中找到挂钩

pyinstaller test.py

对于 anaconda 案例,您必须在以下位置找到它们:

Anaconda\Lib\site-packages\PyInstaller\hooks

对于其他环境,您还可以查看站点包目录