Python | 用Pyinstaller打包发布exe应用
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Python | 用Pyinstaller打包发布exe应用,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4534字,纯文字阅读大概需要7分钟。
内容图文
![Python | 用Pyinstaller打包发布exe应用](/upload/InfoBanner/zyjiaocheng/1072/6d43e62e59d7464ca544bfc13522bbfb.jpg)
参考:https://jingyan.baidu.com/article/a378c960b47034b3282830bb.html
https://ask.csdn.net/questions/720080
https://blog.csdn.net/solarnanocar/article/details/82077484
https://www.cnblogs.com/gopythoner/p/6337543.html
https://jingyan.baidu.com/article/bad08e1ed173d409c85121f8.html
需打包程序参考:https://www.cnblogs.com/msxh/p/4966899.html
D:\pythonWorkspace\test>pyinstaller.exe -F -w testa.py 74 INFO: PyInstaller: 3.474 INFO: Python: 3.7.275 INFO: Platform: Windows-10-10.0.16299-SP0 76 INFO: wrote D:\pythonWorkspace\test\testa.spec 80 INFO: UPX is not available. 82 INFO: Extending PYTHONPATH with paths [‘D:\\pythonWorkspace\\test‘, ‘D:\\pythonWorkspace\\test‘] 82 INFO: checking Analysis 87 INFO: Building because D:\pythonWorkspace\test\testa.py changed 87 INFO: Initializing module dependency graph... 89 INFO: Initializing module graph hooks... 91 INFO: Analyzing base_library.zip ... 2803 INFO: running Analysis Analysis-00.toc 2806 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by d:\python\python.exe 3558 INFO: Caching module hooks... 3563 INFO: Analyzing D:\pythonWorkspace\test\testa.py 3788 INFO: Processing pre-find module path hook distutils 3820 INFO: Loading module hooks... 3820 INFO: Loading module hook "hook-distutils.py"... 3823 INFO: Loading module hook "hook-encodings.py"... 3908 INFO: Loading module hook "hook-pkg_resources.py"... 4162 INFO: Processing pre-safe import module hook win32com 4468 INFO: Loading module hook "hook-pydoc.py"... 4469 INFO: Loading module hook "hook-pygame.py"... 4470 WARNING: Hidden import "pygame._view" not found! 4470 INFO: Loading module hook "hook-pythoncom.py"... 4711 INFO: Loading module hook "hook-pywintypes.py"... 4955 INFO: Loading module hook "hook-sysconfig.py"... 4957 INFO: Loading module hook "hook-win32com.py"... 5407 INFO: Loading module hook "hook-xml.py"... 5630 INFO: Looking for ctypes DLLs 5642 INFO: Analyzing run-time hooks ... 5645 INFO: Including run-time hook ‘pyi_rth_pkgres.py‘5648 INFO: Including run-time hook ‘pyi_rth_win32comgenpy.py‘5655 INFO: Looking fordynamic libraries 7280 INFO: Looking for eggs 7281 INFO: Using Python library d:\python\python37.dll 7281 INFO: Found binding redirects: [] 7289 INFO: Warnings written to D:\pythonWorkspace\test\build\testa\warn-testa.txt 7344 INFO: Graph cross-reference written to D:\pythonWorkspace\test\build\testa\xref-testa.html 7353 INFO: checking PYZ 7356 INFO: Building because toc changed 7357 INFO: Building PYZ (ZlibArchive) D:\pythonWorkspace\test\build\testa\PYZ-00.pyz 7953 INFO: Building PYZ (ZlibArchive) D:\pythonWorkspace\test\build\testa\PYZ-00.pyz completed successfully. 7960 INFO: checking PKG 7962 INFO: Building because toc changed 7962 INFO: Building PKG (CArchive) PKG-00.pkg 11987 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully. 11993 INFO: Bootloader d:\python\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe 11993 INFO: checking EXE 11994 INFO: Rebuilding EXE-00.toc because testa.exe missing 11995 INFO: Building EXE from EXE-00.toc 11998 INFO: Appending archive to EXE D:\pythonWorkspace\test\dist\testa.exe 12012 INFO: Building EXE from EXE-00.toc completed successfully.
执行后能在下图路径中的dist文件夹内生成一个exe应用程序,我的是win10系统,经实验,这个应用程序在其他的win10电脑中可以运行,但在win7里不行,若有大神有解决方法,欢迎指点~
D:\pythonWorkspace\test>pyinstaller -D -w testa.py 71 INFO: PyInstaller: 3.471 INFO: Python: 3.7.272 INFO: Platform: Windows-10-10.0.16299-SP0 76 INFO: wrote D:\pythonWorkspace\test\testa.spec 82 INFO: UPX is not available. 84 INFO: Extending PYTHONPATH with paths [‘D:\\pythonWorkspace\\test‘, ‘D:\\pythonWorkspace\\test‘] 84 INFO: checking Analysis 109 INFO: checking PYZ 124 INFO: checking PKG 124 INFO: Bootloader d:\python\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe 124 INFO: checking EXE 124 INFO: Building because console changed 124 INFO: Building EXE from EXE-00.toc 124 INFO: Appending archive to EXE D:\pythonWorkspace\test\build\testa\testa.exe 140 INFO: Building EXE from EXE-00.toc completed successfully. 140 INFO: checking COLLECT WARNING: The output directory "D:\pythonWorkspace\test\dist\testa" and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)y 6765 INFO: Removing dir D:\pythonWorkspace\test\dist\testa 6859 INFO: Building COLLECT COLLECT-00.toc 7280 INFO: Building COLLECT COLLECT-00.toc completed successfully.
执行后,可在上图路径中的dist文件夹内生成一个testa文件夹,经压缩后就可发给他人电脑中运行了,我win10的系统发到win7上可以运行
原文:https://www.cnblogs.com/hemeiwolong/p/10353497.html
内容总结
以上是互联网集市为您收集整理的Python | 用Pyinstaller打包发布exe应用全部内容,希望文章能够帮你解决Python | 用Pyinstaller打包发布exe应用所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。