手动将python的flask程序打包成exe在windows上执行

时间:2024-10-22 08:29:14
(venv) PS D:\django\locallibrary> cd .\websocket_test\ (venv) PS D:\django\locallibrary\websocket_test> pyinstaller --onefile --add-data "templates;templates" --add-data "static;static" app.py 392 INFO: PyInstaller: 6.11.0, contrib hooks: 2024.9 393 INFO: Python: 3.12.3 429 INFO: Platform: Windows-11-10.0.22631-SP0 429 INFO: Python environment: D:\django\locallibrary\venv 430 INFO: wrote D:\django\locallibrary\websocket_test\app.spec 433 INFO: Module search paths (PYTHONPATH): ['D:\\django\\locallibrary\\venv\\Scripts\\pyinstaller.exe', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python312\\python312.zip', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python312\\DLLs', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python312\\Lib', 'C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python312', 'D:\\django\\locallibrary\\venv', 'D:\\django\\locallibrary\\venv\\Lib\\site-packages', 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\setuptools\\_vendor', 'D:\\django\\locallibrary\\websocket_test'] 806 INFO: Appending 'datas' from .spec 807 INFO: checking Analysis 808 INFO: Building Analysis because Analysis-00.toc is non existent 808 INFO: Running Analysis Analysis-00.toc 808 INFO: Target bytecode optimization level: 0 808 INFO: Initializing module dependency graph... 816 INFO: Initializing module graph hook caches... 828 INFO: Analyzing base_library.zip ... 2034 INFO: Processing standard module hook 'hook-heapq.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 2103 INFO: Processing standard module hook 'hook-encodings.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 3587 INFO: Processing standard module hook 'hook-pickle.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 4761 INFO: Caching module dependency graph... 4843 INFO: Looking for Python shared library... 4852 INFO: Using Python shared library: C:\Users\Administrator\AppData\Local\Programs\Python\Python312\python312.dll 4853 INFO: Analyzing D:\django\locallibrary\websocket_test\app.py 5057 INFO: Processing pre-safe-import-module hook 'hook-typing_extensions.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 5059 INFO: SetuptoolsInfo: initializing cached setuptools info... 8643 INFO: Processing standard module hook 'hook-jinja2.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\stdhooks' 9221 INFO: Processing standard module hook 'hook-multiprocessing.util.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 9305 INFO: Processing standard module hook 'hook-xml.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 10367 INFO: Processing standard module hook 'hook-cryptography.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\stdhooks' 11958 INFO: Processing standard module hook 'hook-platform.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 12083 INFO: Processing standard module hook 'hook-sysconfig.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 12450 INFO: Processing standard module hook 'hook-difflib.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 12511 INFO: Processing pre-safe-import-module hook 'hook-importlib_metadata.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 12512 INFO: Setuptools: 'importlib_metadata' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.importlib_metadata'! 12532 INFO: Processing standard module hook 'hook-setuptools.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 12559 INFO: Processing pre-safe-import-module hook 'hook-distutils.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 12582 INFO: Processing pre-safe-import-module hook 'hook-jaraco.functools.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 12585 INFO: Setuptools: 'jaraco.functools' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.jaraco.functools'! 12599 INFO: Processing pre-safe-import-module hook 'hook-more_itertools.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 12600 INFO: Setuptools: 'more_itertools' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.more_itertools'! 12848 INFO: Processing pre-safe-import-module hook 'hook-packaging.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 12868 INFO: Processing standard module hook 'hook-packaging.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 13032 INFO: Processing pre-safe-import-module hook 'hook-jaraco.text.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 13034 INFO: Setuptools: 'jaraco.text' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.jaraco.text'! 13042 INFO: Processing standard module hook 'hook-setuptools._vendor.jaraco.text.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 13044 INFO: Processing pre-safe-import-module hook 'hook-importlib_resources.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 13044 INFO: Setuptools: 'importlib_resources' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.importlib_resources'! 13081 INFO: Processing pre-safe-import-module hook 'hook-zipp.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 13082 INFO: Setuptools: 'zipp' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.zipp'! 13106 INFO: Processing pre-safe-import-module hook 'hook-jaraco.context.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 13106 INFO: Setuptools: 'jaraco.context' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.jaraco.context'! 13114 INFO: Processing pre-safe-import-module hook 'hook-backports.tarfile.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 13114 INFO: Setuptools: 'backports.tarfile' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.backports.tarfile'! 13190 INFO: Processing standard module hook 'hook-backports.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\stdhooks' 13459 INFO: Processing pre-safe-import-module hook 'hook-tomli.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 13460 INFO: Setuptools: 'tomli' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.tomli'! 13954 INFO: Processing standard module hook 'hook-pkg_resources.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 14346 INFO: Processing pre-safe-import-module hook 'hook-platformdirs.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 14346 INFO: Setuptools: 'platformdirs' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.platformdirs'! 14467 INFO: Processing pre-safe-import-module hook 'hook-wheel.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module' 14468 INFO: Setuptools: 'wheel' appears to be a setuptools-vendored copy - creating alias to 'setuptools._vendor.wheel'! 14633 INFO: Processing standard module hook 'hook-setuptools._vendor.importlib_metadata.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks' 15096 INFO: Processing module hooks (post-graph stage)... 15463 INFO: Performing binary vs. data reclassification (19 entries) 15510 INFO: Looking for ctypes DLLs 15542 INFO: Analyzing run-time hooks ... 15545 INFO: Including run-time hook 'pyi_rth_inspect.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks' 15547 INFO: Including run-time hook 'pyi_rth_cryptography_openssl.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\rthooks' 15548 INFO: Including run-time hook 'pyi_rth_pkgutil.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks' 15550 INFO: Including run-time hook 'pyi_rth_multiprocessing.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks' 15552 INFO: Including run-time hook 'pyi_rth_setuptools.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks' 15554 INFO: Including run-time hook 'pyi_rth_pkgres.py' from 'D:\\django\\locallibrary\\venv\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks' 15564 INFO: Looking for dynamic libraries 16752 INFO: Extra DLL search directories (AddDllDirectory): [] 16752 INFO: Extra DLL search directories (PATH): [] 17062 INFO: Warnings written to D:\django\locallibrary\websocket_test\build\app\warn-app.txt 17114 INFO: Graph cross-reference written to D:\django\locallibrary\websocket_test\build\app\xref-app.html 17142 INFO: checking PYZ 17143 INFO: Building PYZ because PYZ-00.toc is non existent 17143 INFO: Building PYZ (ZlibArchive) D:\django\locallibrary\websocket_test\build\app\PYZ-00.pyz 17873 INFO: Building PYZ (ZlibArchive) D:\django\locallibrary\websocket_test\build\app\PYZ-00.pyz completed successfully. 17924 INFO: checking PKG 17924 INFO: Building PKG because PKG-00.toc is non existent 17925 INFO: Building PKG (CArchive) app.pkg 20455 INFO: Building PKG (CArchive) app.pkg completed successfully. 20457 INFO: Bootloader D:\django\locallibrary\venv\Lib\site-packages\PyInstaller\bootloader\Windows-64bit-intel\run.exe 20458 INFO: checking EXE 20458 INFO: Building EXE because EXE-00.toc is non existent 20458 INFO: Building EXE from EXE-00.toc 20458 INFO: Copying bootloader EXE to D:\django\locallibrary\websocket_test\dist\app.exe 20739 INFO: Copying icon to EXE 21050 INFO: Copying 0 resources to EXE 21050 INFO: Embedding manifest in EXE 21365 INFO: Appending PKG archive to EXE 21376 INFO: Fixing EXE headers 21447 INFO: Building EXE from EXE-00.toc completed successfully.