這篇文章主要為大家展示了“怎么將python文件打包成exe獨(dú)立運(yùn)行程序”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“怎么將python文件打包成exe獨(dú)立運(yùn)行程序”這篇文章吧。
我們提供的服務(wù)有:成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、微信公眾號(hào)開(kāi)發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、菏澤ssl等。為上1000+企事業(yè)單位解決了網(wǎng)站和推廣的問(wèn)題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的菏澤網(wǎng)站制作公司首先需要安裝pyinstaller庫(kù)。pip install pyinstallerexe程序打包步驟
cmd 進(jìn)入要編譯的python文件所在的文件夾,
然后
pyinstaller -F hello.py
hello.py就是我要打包的文件。
常用參數(shù):
-F 生成單個(gè)的exe文件。
-w 隱藏運(yùn)行窗口。
-h 可以查看幫助信息,更多指令可以通過(guò)這個(gè)查看。
最開(kāi)始 D:\pyinstaller 目錄下只有hello.py這一個(gè)文件,其它的文件都是后生成的。
生成的exe文件在dist里,這個(gè)exe文件單獨(dú)拿出來(lái)放在任何的位置都可以運(yùn)行。
編譯過(guò)程:
出現(xiàn)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
以上是“怎么將python文件打包成exe獨(dú)立運(yùn)行程序”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
文章名稱:怎么將python文件打包成exe獨(dú)立運(yùn)行程序-創(chuàng)新互聯(lián)
URL網(wǎng)址:http://jinyejixie.com/article48/diecep.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站、微信小程序、品牌網(wǎng)站制作、網(wǎng)站導(dǎo)航、商城網(wǎng)站、軟件開(kāi)發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容