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

一 点睛

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

二 打包

1 CMD命令进入命令行

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

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

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

执行结果如下:

(venv) E:\Python\studentsystem>pyinstaller -F E:\Python\studentsystem\studentsystem.py
354 INFO: PyInstaller: 3.4
354 INFO: Python: 3.6.7
355 INFO: Platform: Windows-10-10.0.17134-SP0
356 INFO: wrote E:\Python\studentsystem\studentsystem.spec
366 INFO: UPX is not available.
370 INFO: Extending PYTHONPATH with paths
['E:\\Python\\studentsystem', 'E:\\Python\\studentsystem']
371 INFO: checking Analysis
371 INFO: Building Analysis because Analysis-00.toc is non existent
371 INFO: Initializing module dependency graph...
374 INFO: Initializing module graph hooks...
376 INFO: Analyzing base_library.zip ...
3833 INFO: running Analysis Analysis-00.toc
3894 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by E:\Python\studentsystem\venv\Scripts\python.exe
4603 INFO: Caching module hooks...
4610 INFO: Analyzing E:\Python\studentsystem\studentsystem.py
4650 INFO: Loading module hooks...
4650 INFO: Loading module hook "hook-encodings.py"...
4794 INFO: Loading module hook "hook-pydoc.py"...
4797 INFO: Loading module hook "hook-xml.py"...
5039 INFO: Looking for ctypes DLLs
5039 INFO: Analyzing run-time hooks ...
5043 INFO: Looking for dynamic libraries
5260 INFO: Looking for eggs
5260 INFO: Using Python library E:\Python\studentsystem\venv\Scripts\python36.dll
5261 INFO: Found binding redirects:
[]
5265 INFO: Warnings written to E:\Python\studentsystem\build\studentsystem\warn-studentsystem.txt
5298 INFO: Graph cross-reference written to E:\Python\studentsystem\build\studentsystem\xref-studentsystem.html
5317 INFO: checking PYZ
5318 INFO: Building PYZ because PYZ-00.toc is non existent
5318 INFO: Building PYZ (ZlibArchive) E:\Python\studentsystem\build\studentsystem\PYZ-00.pyz
5718 INFO: Building PYZ (ZlibArchive) E:\Python\studentsystem\build\studentsystem\PYZ-00.pyz completed successfully.
5722 INFO: checking PKG
5723 INFO: Building PKG because PKG-00.toc is non existent
5723 INFO: Building PKG (CArchive) PKG-00.pkg
7957 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
7965 INFO: Bootloader E:\Python\studentsystem\venv\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
7967 INFO: checking EXE
7967 INFO: Building EXE because EXE-00.toc is non existent
7968 INFO: Building EXE from EXE-00.toc
7969 INFO: Appending archive to EXE E:\Python\studentsystem\dist\studentsystem.exe
8000 INFO: Building EXE from EXE-00.toc completed successfully.

三 验证

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值