I encountered the above problem when packaging a standalone python environment.
This problem is mainly caused by the inconsistency between the software execution environment and the compilation environment.
That is, the environment for executing python and the environment for compiling python need to be consistent.
Specifically, python packaged under linux cannot be executed under mac.
It is not easy to distinguish the compilation environment of python, except for the obvious distinction on the official website. In daily cooperation, it is common to lack the corresponding documentation corresponding to the customized python environment.
You can use file program under linux or mac to view the compilation environment of the program.