Python | 用Pyinstaller打包发布exe应用

参考: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.4
74 INFO: Python: 3.7.2
75 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 for dynamic 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.4
71 INFO: Python: 3.7.2
72 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

时间: 2024-08-30 16:11:02

Python | 用Pyinstaller打包发布exe应用的相关文章

Python3快速入门(十八)——PyInstaller打包发布

Python3快速入门(十八)--PyInstaller打包发布 一.PyInstaller简介 1.PyInstaller简介 PyInstaller是一个跨平台的Python应用打包工具,支持 Windows/Linux/MacOS三大主流平台,能够把 Python 脚本及其所在的 Python 解释器打包成可执行文件,从而允许最终用户在无需安装 Python 的情况下执行应用程序.PyInstaller 制作出来的执行文件并不是跨平台的,如果需要为不同平台打包,就要在相应平台上运行PyIn

Pyinstaller打包生成exe文件过大,四种常用处理方法集锦---嵌入式Python-02

上篇讲到 pyinstaller打包exe太大的问题 CodingDog:pyinstaller打包的exe太大?你需要嵌入式python玄学 前提篇?zhuanlan.zhihu.com 那既然pyinstaller这么麻(nan)烦(yong) 那为什么不找一种方法代替它呢? 经过多方面打听,一位道上的盆友告诉了我一个惊天大秘密 python有embedded版本 当我看完了官方的文档以后...我的表情是这样的 惊喜&惊喜&惊喜&惊喜 像发现了新大陆一样 python37的em

转:Python用PyInstaller打包笔记

转自http://www.itoldme.net/archives/1242 为了把python发行到没有安装python的Windows环境使用,需要打包成exe可执行文件.现在常见的python打包工具有cx_Freeze.PyInstaller和py2exe,想想我当初接触python的时候,似乎只有py2exe,而且有不少问题时光荏苒,一切过的真快.本文介绍PyInstaller打包的使用. 一.准备工作 安装PyWin32 到http://sourceforge.net/project

python 使用pyinstaller打包程序

使用pyinstaller 打包.py脚本,在其他计算机可以直接运行,不需要python环境 安装pyinstaller库 pip install pystaller 打包程序 pyinstaller -F *.py 会生成三个文件,程序在dist文件里,其他两个文件夹可以删除 打包程序并使用指点图标 命令 pyinstaller -i <图标文件名.ico> -F *.py 原文地址:https://www.cnblogs.com/sineik/p/9226195.html

[Python][小知识][NO.5] 使用 Pyinstaller 打包成.exe文件

1.安装 pyinstaller 插件 cmd命令:pip install PyInstaller PS . o.o 不知道 easy_install 的百度吧. 2.pyinstaller 简介 他能很方便的帮我把 python脚本打包成一个 .exe 程序. cmd打包指令:pyinstaller [一些参数] [打包 .py 脚本的路径] 打包后会在用户目录下产生 两个文件夹 (其中 打包成品 在 build 文件夹下): 1.当我们什么参数都不给的时候: 打包后的结果为一个文件夹: 文件

Python学习笔记-打包发布Python模块或程序,安装包

Python模块.扩展和应用程序可以按以下几种形式进行打包和发布: python setup.py获取帮助的方式 python setup.py --help python setup.py --help-commands 所有可以使用的命令,如build,install python setup.py COMMAND --help 获取特定命令的帮助 python setup.py COMMAND --help-formats 获取特定命令支持使用的格式 打包 1.压缩文件(使用distuti

解决: PyInstaller打包后exe文件打开时出现failed to execute script

def resource_path(self, relative): if hasattr(sys, "_MEIPASS"): return os.path.join(sys._MEIPASS, relative) return os.path.join(relative) def copy_GUI(self): root = tkinter.Tk() root.title("U盘拷贝小工具 v6.0") root.geometry("400x260&qu

Qt打包发布exe

1.首先以 release 方式编译源代码,然后将生成的a. exe 程序放到一个单独的文件夹中. 2.再从开始菜单打开 Qt 命令行工具. 3.在命令行中,进入到第一步中a. exe 程序所在的文件夹. 4.再使用 Qt 自带的 windeployqt 工具命令 windeployqt  a.exe 可能会出错: 无法定位程序输入点在--zdapvj于动态链接库libstdc++6.dll 复制一个正确的libstdc++-6.dll到 执行文件夹下(exe 所在的文件夹),即可解决. 可参考

PyInstaller将python脚本打包成exe可执行程序

一.PyInstaller说明 pyinstaller是一个第三方模块,托管在github上,它是一个把python脚本及其依赖的模块,打包成一个独立的可执行程序,使其能运行在没有安装python环境的机器上.支持Linux/unix /mac 及windows,但注意的是,在什么平台上打包,就会生成对应平台可执行的独立程序,如在windows上打包会生成exe的可执行文件.本文所演示的就是在windows平台使用pyinstaller打包一个简单的exe程序. 二.原始脚本内容如下: 1.生成