1.安装 pyinstaller模块
pip install pyinstaller
Microsoft Windows [ 版本 10.0 .19044 .1348 ]
( c ) Microsoft Corporation。保留所有权利。
C : \ Users \ 13600 > pip install pyinstaller
DEPRECATION : Python 2.7 will reach the end of its life on January 1 st , 2020. Please upgrade your Python as Python 2.7 won ' t be maintained after that date . A future version of pip will drop support for Python 2.7 . More details about Python 2 support in pip , can be found at https : / / pip . pypa . io / en / latest / development / release-process / # python- 2 -support
Collecting pyinstaller
Downloading https : / / files . pythonhosted . org / packages / 9 e / ed / fbdad7f5d8f794c901076b814b8e9f5ce31d32c0bc3b63ddd27b61db9530 / pyinstaller- 4.1 . tar . gz ( 3.5 MB )
| ████████ | 901 kB 19 kB / s eta 0 : 02 : 14
2.注意点
1. 一定要将pip添加到环境变量中去才能之前使用pip
2. 如果系统提示缺少组件
百度 --- > DirectX修复工具 --- > 运行修复
https : / / xiazai . zol . com . cn / detail / 44 / 430281. shtml
3.打包
pyinstaller -F 路径 / 名字 . py
C : \ Users \ 13600 > pyinstaller -F F : \ backups \ notes \ Project \ name \ name . py
107 INFO : PyInstaller : 3.6
108 INFO : Python : 3.6 .8
108 INFO : Platform : Windows- 10 - 10.0 .19041 -SP0
109 INFO : wrote C : \ Users \ 13600 \ name . spec
111 INFO : UPX is not available .
118 INFO : Extending PYTHONPATH with paths
[ 'F:\\backups\\notes\\Project\\name' , 'C:\\Users\\13600' ]
119 INFO : checking Analysis
159 INFO : checking PYZ
187 INFO : checking PKG
187 INFO : Building because toc changed
187 INFO : Building PKG ( CArchive ) PKG- 00. pkg
1958 INFO : Building PKG ( CArchive ) PKG- 00. pkg completed successfully .
1960 INFO : Bootloader d : \ python \ python36 \ lib \ site-packages \ PyInstaller \ bootloader \ Windows- 64 bit \ run . exe
1960 INFO : checking EXE
1970 INFO : Rebuilding EXE- 00. toc because name . exe missing
1970 INFO : Building EXE from EXE- 00. toc
1971 INFO : Appending archive to EXE C : \ Users \ 13600 \ dist \ name . exe
1982 INFO : Building EXE from EXE- 00. toc completed successfully .
1971 INFO : Appending archive to EXE C : \ Users \ 13600 \ dist \ name . exe
倒数第二行存放exe的路径。
改个名字 ok
必须将整个文件复制出去使用
可以选中 右击 发送到桌面 就好了