pyinstaller官方文档
虽然是英文,但能看就能少走很多弯路,像使用-F打包,遇到fileNotFoundError之类的问题,都能知其然,知其所以然地解决。
以下是摘录的一段打包单文件的工作原理
The bootloader is the heart of the one-file bundle also. When started it creates a temporary folder in the appropriate temp-folder location for this OS. The folder is named _MEIxxxxxx, where xxxxxx is a random number.
The one executable file contains an embedded archive of all the Python modules used by your script, as well as compressed copies of any non-Python support files (e.g. .so files). The bootloader uncompresses the support files and writes copies into the the temporary folder. This can take a little time. That is why a one-file app is a little slower to start than a one-folder app.
Afte