将python文件打包exe独立运行程序方法详解
作者:挣扎的蓝藻 发布时间:2021-07-03 02:26:41
标签:python,打包,exe
首先需要安装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.4
96 INFO: Python: 3.6.8
97 INFO: Platform: Windows-7-6.1.7601-SP1
98 INFO: wrote D:\pyinstaller\hello.spec
105 INFO: UPX is not available.
107 INFO: Extending PYTHONPATH with paths
['D:\\pyinstaller', 'D:\\pyinstaller']
107 INFO: checking Analysis
108 INFO: Building Analysis because Analysis-00.toc is non existent
108 INFO: Initializing module dependency graph...
110 INFO: Initializing module graph hooks...
112 INFO: Analyzing base_library.zip ...
4577 INFO: running Analysis Analysis-00.toc
4582 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of f
inal executable
required by d:\python3.6.8\python.exe
5582 INFO: Caching module hooks...
5590 INFO: Analyzing D:\pyinstaller\hello.py
5596 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 DLLs
6152 INFO: Analyzing run-time hooks ...
6164 INFO: Looking for dynamic libraries
6287 INFO: Looking for eggs
6287 INFO: Using Python library d:\python3.6.8\python36.dll
6288 INFO: Found binding redirects:
[]
6294 INFO: Warnings written to D:\pyinstaller\build\hello\warn-hello.txt
6349 INFO: Graph cross-reference written to D:\pyinstaller\build\hello\xref-hell
o.html
6357 INFO: checking PYZ
6358 INFO: Building PYZ because PYZ-00.toc is non existent
6359 INFO: Building PYZ (ZlibArchive) D:\pyinstaller\build\hello\PYZ-00.pyz
7000 INFO: Building PYZ (ZlibArchive) D:\pyinstaller\build\hello\PYZ-00.pyz comp
leted successfully.
7006 INFO: checking PKG
7007 INFO: Building PKG because PKG-00.toc is non existent
7007 INFO: Building PKG (CArchive) PKG-00.pkg
8818 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
8822 INFO: Bootloader d:\python3.6.8\lib\site-packages\PyInstaller\bootloader\Wi
ndows-32bit\run.exe
8822 INFO: checking EXE
8823 INFO: Building EXE because EXE-00.toc is non existent
8824 INFO: Building EXE from EXE-00.toc
8826 INFO: Appending archive to EXE D:\pyinstaller\dist\hello.exe
来源:https://blog.csdn.net/qq_38161040/article/details/89302030
0
投稿
猜你喜欢
- 一、安装FastDFS1-1:执行docker命令安装# 安装trackerdocker run -dti --network=host -
- 进程Process是对各种资源管理的集合,包含对各种资源的调用、内存的管理、网络接口的调用;一个进程Process可以包含多个子进程,启动一
- 通过第三方库exifread读取照片信息。exifread官网:https://pypi.org/project/ExifRead/一、安装
- 本文实例为大家分享了Python曲线拟合的最小二乘法,供大家参考,具体内容如下模块导入import numpy as npimport ga
- 例1import osprint 'Process (%s) start...' %os.getpid()pid = os.
- ''' 爬取豆瓣电影排行榜 设计思路: &nb
- 什么是标签平滑?在PyTorch中如何去使用它?在训练深度学习模型的过程中,过拟合和概率校准(probability calibration
- 什么是索引?哪些数据类型里有索引的概念? —> 字符串、列表、元组从最左边记录的位置开始就是索引索引用数字表示,起
- 本文实例展示了Python Tkinter基础控件的用法,分享给大家供大家参考之用。具体方法如下:# -*- coding: utf-8 -
- What's more important to your web site: pictures or text? If you h
- PJBLOG3的相关日志,现在网上好像还没有谁有相关的修改说明吧,反正升级之后,正好有必要,也就写了个,在这里也给大家共享共享。当前相关日志
- 前一篇研究了opencv二值化方法threshold的使用,但是这个方法也存在一定的局限性,假如有一张图存在明显的明暗不同的区域,如下图可以
- 比如 1--1 2--1  
- 一、弹窗事件是什么?弹窗事件就是在我们执行某操作的时候,弹出信息框给出提示。或收集数据的时候,弹出窗口收集信息,不想收集可以取消隐藏。二、简
- 用for循环实现1~n求和的方法def main(): sum = 0 n = int(input('n=&
- 环境:winxp sp2 ,mysql5.0.18,mysql odbc 3.51 driver 表采用 myisam引擎。access 2
- 作为一个信号库,使用时候是支持一对一以及一对多的订阅模式,可以实现发送数据等,一般情况下,只要能够使用到Blinker的,一般都是应用在技术
- CSS+DIV是网站标准(或称“WEB标准”)中常用的术语之一,通常为了说明与HTML网页设计语言中的表格(table)定位方式的区别,因为
- Function Moneynm(n,m) &
- 本文实例讲述了Go语言使用sort包对任意类型元素的集合进行排序的方法。分享给大家供大家参考。具体如下:使用sort包的函数进行排序时,集合