python文件打包为.exe可执行文件

短命女 2021-09-19 22:24 592阅读 0赞

一 点睛

Python项目打包需要安装PyInstaller模块。

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NoZW5ncWl1bWluZw_size_16_color_FFFFFF_t_70

二 打包

1 CMD命令进入命令行

2 在命令行执行如下语句:

  1. pyinstaller -F E:\Python\studentsystem\studentsystem.py

其中-F 表示只生成一个扩展名为.exe的可执行文件。

执行结果如下:

  1. (venv) E:\Python\studentsystem>pyinstaller -F E:\Python\studentsystem\studentsystem.py
  2. 354 INFO: PyInstaller: 3.4
  3. 354 INFO: Python: 3.6.7
  4. 355 INFO: Platform: Windows-10-10.0.17134-SP0
  5. 356 INFO: wrote E:\Python\studentsystem\studentsystem.spec
  6. 366 INFO: UPX is not available.
  7. 370 INFO: Extending PYTHONPATH with paths
  8. ['E:\\Python\\studentsystem', 'E:\\Python\\studentsystem']
  9. 371 INFO: checking Analysis
  10. 371 INFO: Building Analysis because Analysis-00.toc is non existent
  11. 371 INFO: Initializing module dependency graph...
  12. 374 INFO: Initializing module graph hooks...
  13. 376 INFO: Analyzing base_library.zip ...
  14. 3833 INFO: running Analysis Analysis-00.toc
  15. 3894 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  16. required by E:\Python\studentsystem\venv\Scripts\python.exe
  17. 4603 INFO: Caching module hooks...
  18. 4610 INFO: Analyzing E:\Python\studentsystem\studentsystem.py
  19. 4650 INFO: Loading module hooks...
  20. 4650 INFO: Loading module hook "hook-encodings.py"...
  21. 4794 INFO: Loading module hook "hook-pydoc.py"...
  22. 4797 INFO: Loading module hook "hook-xml.py"...
  23. 5039 INFO: Looking for ctypes DLLs
  24. 5039 INFO: Analyzing run-time hooks ...
  25. 5043 INFO: Looking for dynamic libraries
  26. 5260 INFO: Looking for eggs
  27. 5260 INFO: Using Python library E:\Python\studentsystem\venv\Scripts\python36.dll
  28. 5261 INFO: Found binding redirects:
  29. []
  30. 5265 INFO: Warnings written to E:\Python\studentsystem\build\studentsystem\warn-studentsystem.txt
  31. 5298 INFO: Graph cross-reference written to E:\Python\studentsystem\build\studentsystem\xref-studentsystem.html
  32. 5317 INFO: checking PYZ
  33. 5318 INFO: Building PYZ because PYZ-00.toc is non existent
  34. 5318 INFO: Building PYZ (ZlibArchive) E:\Python\studentsystem\build\studentsystem\PYZ-00.pyz
  35. 5718 INFO: Building PYZ (ZlibArchive) E:\Python\studentsystem\build\studentsystem\PYZ-00.pyz completed successfully.
  36. 5722 INFO: checking PKG
  37. 5723 INFO: Building PKG because PKG-00.toc is non existent
  38. 5723 INFO: Building PKG (CArchive) PKG-00.pkg
  39. 7957 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
  40. 7965 INFO: Bootloader E:\Python\studentsystem\venv\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
  41. 7967 INFO: checking EXE
  42. 7967 INFO: Building EXE because EXE-00.toc is non existent
  43. 7968 INFO: Building EXE from EXE-00.toc
  44. 7969 INFO: Appending archive to EXE E:\Python\studentsystem\dist\studentsystem.exe
  45. 8000 INFO: Building EXE from EXE-00.toc completed successfully.

三 验证

watermark_type_ZmFuZ3poZW5naGVpdGk_shadow_10_text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2NoZW5ncWl1bWluZw_size_16_color_FFFFFF_t_70 1

发表评论

表情:
评论列表 (有 0 条评论,592人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Java 项目打包.exe执行文件

    自己写了项目,想整理成exe,按照网上自己弄了一下,自己又摸索着,让exe带背景图片,自己重新做了好几次才完全做成自己想要的,感觉网上都没有特别详细的,写了关于这方面的博客,希