将python文件打包exe独立运行程序方法详解
首先需要安装pyinstaller库。
pipinstallpyinstaller
exe程序打包步骤
cmd进入要编译的python文件所在的文件夹,
然后
pyinstaller-Fhello.py
hello.py就是我要打包的文件。
常用参数:
-F生成单个的exe文件。
-w隐藏运行窗口。
-h可以查看帮助信息,更多指令可以通过这个查看。
最开始D:\pyinstaller目录下只有hello.py这一个文件,其它的文件都是后生成的。
生成的exe文件在dist里,这个exe文件单独拿出来放在任何的位置都可以运行。
编译过程:
出现completedsuccessfully就成功了。
96INFO:PyInstaller:3.4 96INFO:Python:3.6.8 97INFO:Platform:Windows-7-6.1.7601-SP1 98INFO:wroteD:\pyinstaller\hello.spec 105INFO:UPXisnotavailable. 107INFO:ExtendingPYTHONPATHwithpaths ['D:\\pyinstaller','D:\\pyinstaller'] 107INFO:checkingAnalysis 108INFO:BuildingAnalysisbecauseAnalysis-00.tocisnonexistent 108INFO:Initializingmoduledependencygraph... 110INFO:Initializingmodulegraphhooks... 112INFO:Analyzingbase_library.zip... 4577INFO:runningAnalysisAnalysis-00.toc 4582INFO:AddingMicrosoft.Windows.Common-Controlstodependentassembliesoff inalexecutable requiredbyd:\python3.6.8\python.exe 5582INFO:Cachingmodulehooks... 5590INFO:AnalyzingD:\pyinstaller\hello.py 5596INFO:Loadingmodulehooks... 5597INFO:Loadingmodulehook"hook-encodings.py"... 5845INFO:Loadingmodulehook"hook-pydoc.py"... 5847INFO:Loadingmodulehook"hook-xml.py"... 6152INFO:LookingforctypesDLLs 6152INFO:Analyzingrun-timehooks... 6164INFO:Lookingfordynamiclibraries 6287INFO:Lookingforeggs 6287INFO:UsingPythonlibraryd:\python3.6.8\python36.dll 6288INFO:Foundbindingredirects: [] 6294INFO:WarningswrittentoD:\pyinstaller\build\hello\warn-hello.txt 6349INFO:Graphcross-referencewrittentoD:\pyinstaller\build\hello\xref-hell o.html 6357INFO:checkingPYZ 6358INFO:BuildingPYZbecausePYZ-00.tocisnonexistent 6359INFO:BuildingPYZ(ZlibArchive)D:\pyinstaller\build\hello\PYZ-00.pyz 7000INFO:BuildingPYZ(ZlibArchive)D:\pyinstaller\build\hello\PYZ-00.pyzcomp letedsuccessfully. 7006INFO:checkingPKG 7007INFO:BuildingPKGbecausePKG-00.tocisnonexistent 7007INFO:BuildingPKG(CArchive)PKG-00.pkg 8818INFO:BuildingPKG(CArchive)PKG-00.pkgcompletedsuccessfully. 8822INFO:Bootloaderd:\python3.6.8\lib\site-packages\PyInstaller\bootloader\Wi ndows-32bit\run.exe 8822INFO:checkingEXE 8823INFO:BuildingEXEbecauseEXE-00.tocisnonexistent 8824INFO:BuildingEXEfromEXE-00.toc 8826INFO:AppendingarchivetoEXED:\pyinstaller\dist\hello.exe
更多关于将python文件打包exe独立运行程序方法请查看下面的相关链接
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。