Python 技术篇-将python项目打包成exe独立运行程序,pyinstaller库打包python代码实例演示
发布日期:2021-06-30 16:49:09
浏览次数:3
分类:技术文章
本文共 2441 字,大约阅读时间需要 8 分钟。
首先需要安装 pyinstaller 库。 pip install pyinstaller
就可以了。
exe程序打包步骤
cmd 进入要编译的 python 文件所在的文件夹, 然后pyinstaller -F hello.py
就好了,hello.py 就是我要打包的文件。
常用参数: -F 生成单个的 exe 文件。 -w 隐藏运行窗口。 -h 可以查看帮助信息,更多指令可以通过这个查看。 最开始 D:\pyinstaller 目录下只有 hello.py 这一个文件,其它的文件都是后生成的。 生成的 exe 文件在 dist 里,这个 exe 文件单独拿出来放在任何的位置都可以运行。 编译过程: 出现 completed successfully 就成功了。
96 INFO: PyInstaller: 3.496 INFO: Python: 3.6.897 INFO: Platform: Windows-7-6.1.7601-SP198 INFO: wrote D:\pyinstaller\hello.spec105 INFO: UPX is not available.107 INFO: Extending PYTHONPATH with paths['D:\\pyinstaller', 'D:\\pyinstaller']107 INFO: checking Analysis108 INFO: Building Analysis because Analysis-00.toc is non existent108 INFO: Initializing module dependency graph...110 INFO: Initializing module graph hooks...112 INFO: Analyzing base_library.zip ...4577 INFO: running Analysis Analysis-00.toc4582 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by d:\python3.6.8\python.exe5582 INFO: Caching module hooks...5590 INFO: Analyzing D:\pyinstaller\hello.py5596 INFO: Loading module hooks...5597 INFO: Loading module hook "hook-encodings.py"...5845 INFO: Loading module hook "hook-pydoc.py"...5847 INFO: Loading module hook "hook-xml.py"...6152 INFO: Looking for ctypes DLLs6152 INFO: Analyzing run-time hooks ...6164 INFO: Looking for dynamic libraries6287 INFO: Looking for eggs6287 INFO: Using Python library d:\python3.6.8\python36.dll6288 INFO: Found binding redirects:[]6294 INFO: Warnings written to D:\pyinstaller\build\hello\warn-hello.txt6349 INFO: Graph cross-reference written to D:\pyinstaller\build\hello\xref-hello.html6357 INFO: checking PYZ6358 INFO: Building PYZ because PYZ-00.toc is non existent6359 INFO: Building PYZ (ZlibArchive) D:\pyinstaller\build\hello\PYZ-00.pyz7000 INFO: Building PYZ (ZlibArchive) D:\pyinstaller\build\hello\PYZ-00.pyz completed successfully.7006 INFO: checking PKG7007 INFO: Building PKG because PKG-00.toc is non existent7007 INFO: Building PKG (CArchive) PKG-00.pkg8818 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.8822 INFO: Bootloader d:\python3.6.8\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe8822 INFO: checking EXE8823 INFO: Building EXE because EXE-00.toc is non existent8824 INFO: Building EXE from EXE-00.toc8826 INFO: Appending archive to EXE D:\pyinstaller\dist\hello.exe8836 INFO: Building EXE from EXE-00.toc completed successfully.
喜欢的点个赞❤吧!
转载地址:https://lanzao.blog.csdn.net/article/details/89302030 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
表示我来过!
[***.240.166.169]2024年04月05日 13时08分57秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
基于CentOS 7的Linux常用命令行命令
2019-04-30
行阶梯型矩阵
2019-04-30
信号量机制
2019-04-30
临界资源与临界区
2019-04-30
matlab中uint8,double,im2double和im2uint8的区别
2019-04-30
数字图像处理总复习
2019-04-30
图像去噪(包含修正的阿尔法均值滤波及通用滤波方法代码)
2019-04-30
SVM进行人脸检测
2019-04-30
C++学习笔记
2019-04-30
图像处理学习笔记
2019-04-30
Machine Learning Onramp on MATLAB 学习笔记
2019-04-30
Machine Learning with MATLAB 1.1 to 2.2
2019-04-30
Learning DSP with MATLAB
2019-04-30
用MATLAB实现m序列的生成(MATLAB 2021a适用)
2019-04-30
MATLAB函数备忘(定期更新)
2019-04-30
13行MATLAB代码实现网络爬虫 爬取NASA画廊星图
2019-04-30
MATLAB指定路径保存图片方法
2019-04-30
Python一键获取微信推送封面图
2019-04-30
油猴脚本:微信推送浏览功能拓展
2019-04-30
JavaScript DOM对象操作详解
2019-04-30