I recently tried pyInstaller and there are some things i don\'t quite get. i have been trying to create some executables (NOTE: all of them use numpy, scipy, OpenCV, BLAS et
From the pyinstaller documentation
hiddenimports
A list of modules names (relative or absolute) the module imports in some untrackable way.
Some Python imports are untrackable during static analysis of your program. eg Your code may create the name of a module to import using Python code, and then import that module. In this case, pyinstaller will be unable to work out during its code analysis, what is the name of the module to import. If you know ahead of time, then you can tell pyinstaller to unconditionally include these modules.
Hooks are a way for you to bundle a set of hidden imports and other parameters to do with finding modules. Hooks are named hook-
where module is a fully qualified module name. eg hook-xml.dom.py
. If your code does import xml.dom
, then the contents of the hook script are read to include any hidden imports specific to xml.dom
.
If you create your own module and it requires hidden imports, you can create a hook script with the appropriate hidden imports settings and store in the PyInstaller hooks directory. The next time you use PyInstaller to freeze a program which imports your module, it will automatically find your hook file and pull in the required hidden imports without you having to remember each time what the hidden imports are for your module.
The documentation has more information about how all of this works but hopefully this provides some more background information.