Python打包exe

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 1st, 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/9e/ed/fbdad7f5d8f794c901076b814b8e9f5ce31d32c0bc3b63ddd27b61db9530/pyinstaller-4.1.tar.gz (3.5MB)
     |████████                        | 901kB 19kB/s eta 0:02:14
2.注意点
1. 一定要将pip添加到环境变量中去才能之前使用pip

image-20211126152542628

image-20211126152635645

2. 如果系统提示缺少组件
百度 --->  DirectX修复工具  ---> 运行修复
https://xiazai.zol.com.cn/detail/44/430281.shtml

image-20211126162144305

image-20211126162247315

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-64bit\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的路径。

image-20211126162350079

改个名字  ok
必须将整个文件复制出去使用
可以选中 右击 发送到桌面 就好了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值