用Pyinstaller打包發布exe應用

2021-08-20 12:42:23 字數 696 閱讀 9461

pyinstaller( 先去官網看支援的python版本

#安裝方法1

1.cmd到/python/scripts 找到pyinstaller.exe

2.輸入命令

1

pyinstaller.exe -f path:demo.py

後記:1.程式設定自定義圖示:pyinstaller -f -i ico_path  py_path 

改為ico:  

輸入命令 pyinstaller -f -i "demo.ico" "main.py"

pyinstaller -f -i "demo.ico" "main.py" 命令格式一定是先圖示路徑,再程式路徑。

路徑最好為英文,沒有中文字元;指令碼名稱裡沒有特殊字元如 .

使用utf8編碼

圖示檔案必須是正常格式,不能直接更改字尾。

tuble index out of range ---》pyinstaller版本尚未支援python的版本

3.視窗程式

使用 pyinstaller -f -w  -i ico_path  py_path ,這樣指令碼不會彈出命令窗,前提是用了gui庫. 

4.匯入模組問題

pyinstaller -f -w  -i  --hidden-import queue ico_path  py_path 加上選項

用 PyInstaller 打包封裝python

pip install pyinstallertest.py 以及 test.png test2.png 用於介面顯示到圖示檔案。輸出乙個test 可以執行程式檔案,可直接執行。如 test.實際上,這個檔案可執行程式檔案是乙個包,執行過程中會將這個包解壓縮到 tmp mei 路徑下,執行結束會自動...

用pyinstaller打包exe常見問題

看網上說,先解除安裝原來的pyinstaller 再從github重新安裝pyinstaller 嗯,照做了,很好,換了個錯誤。如果第一步之後你還是閃退,那就在控制台中執行,然後看錯誤,我的錯誤就是no module 網上有解決方法如下 1.先用pyinstaller d f py生成一下 不一定能...

pyinstaller打包程式

python打包成exe檔案時,用的是pyinstaller 第一步安裝pyinstaller pip install pyinstaller第二步 pyinstaller f w i ico py其中 ico 是logo,py是你要打包的py檔案 我在打包時出現了struct.error unpa...