Python | 用Pyinstaller打包发布exe应用,,参考:https:/


参考: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.py74 INFO: PyInstaller: 3.474 INFO: Python: 3.7.275 INFO: Platform: Windows-10-10.0.16299-SP076 INFO: wrote D:\pythonWorkspace\test\testa.spec80 INFO: UPX is not available.82 INFO: Extending PYTHONPATH with paths[‘D:\\pythonWorkspace\\test‘, ‘D:\\pythonWorkspace\\test‘]82 INFO: checking Analysis87 INFO: Building because D:\pythonWorkspace\test\testa.py changed87 INFO: Initializing module dependency graph...89 INFO: Initializing module graph hooks...91 INFO: Analyzing base_library.zip ...2803 INFO: running Analysis Analysis-00.toc2806 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable  required by d:\python\python.exe3558 INFO: Caching module hooks...3563 INFO: Analyzing D:\pythonWorkspace\test\testa.py3788 INFO: Processing pre-find module path hook   distutils3820 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   win32com4468 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 DLLs5642 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 for dynamic libraries7280 INFO: Looking for eggs7281 INFO: Using Python library d:\python\python37.dll7281 INFO: Found binding redirects:[]7289 INFO: Warnings written to D:\pythonWorkspace\test\build\testa\warn-testa.txt7344 INFO: Graph cross-reference written to D:\pythonWorkspace\test\build\testa\xref-testa.html7353 INFO: checking PYZ7356 INFO: Building because toc changed7357 INFO: Building PYZ (ZlibArchive) D:\pythonWorkspace\test\build\testa\PYZ-00.pyz7953 INFO: Building PYZ (ZlibArchive) D:\pythonWorkspace\test\build\testa\PYZ-00.pyz completed successfully.7960 INFO: checking PKG7962 INFO: Building because toc changed7962 INFO: Building PKG (CArchive) PKG-00.pkg11987 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.11993 INFO: Bootloader d:\python\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe11993 INFO: checking EXE11994 INFO: Rebuilding EXE-00.toc because testa.exe missing11995 INFO: Building EXE from EXE-00.toc11998 INFO: Appending archive to EXE D:\pythonWorkspace\test\dist\testa.exe12012 INFO: Building EXE from EXE-00.toc completed successfully.

执行后能在下图路径中的dist文件夹内生成一个exe应用程序,我的是win10系统,经实验,这个应用程序在其他的win10电脑中可以运行,但在win7里不行,若有大神有解决方法,欢迎指点~

技术图片

D:\pythonWorkspace\test>pyinstaller -D -w testa.py71 INFO: PyInstaller: 3.471 INFO: Python: 3.7.272 INFO: Platform: Windows-10-10.0.16299-SP076 INFO: wrote D:\pythonWorkspace\test\testa.spec82 INFO: UPX is not available.84 INFO: Extending PYTHONPATH with paths[‘D:\\pythonWorkspace\\test‘, ‘D:\\pythonWorkspace\\test‘]84 INFO: checking Analysis109 INFO: checking PYZ124 INFO: checking PKG124 INFO: Bootloader d:\python\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe124 INFO: checking EXE124 INFO: Building because console changed124 INFO: Building EXE from EXE-00.toc124 INFO: Appending archive to EXE D:\pythonWorkspace\test\build\testa\testa.exe140 INFO: Building EXE from EXE-00.toc completed successfully.140 INFO: checking COLLECTWARNING: The output directory "D:\pythonWorkspace\test\dist\testa" and ALL ITS CONTENTS will be REMOVED! Continue? (y/n)y6765 INFO: Removing dir D:\pythonWorkspace\test\dist\testa6859 INFO: Building COLLECT COLLECT-00.toc7280 INFO: Building COLLECT COLLECT-00.toc completed successfully.

执行后,可在上图路径中的dist文件夹内生成一个testa文件夹,经压缩后就可发给他人电脑中运行了,我win10的系统发到win7上可以运行

技术图片

Python | 用Pyinstaller打包发布exe应用

评论关闭