python 打包成exe 可執行檔案

2021-09-25 03:32:28 字數 307 閱讀 1446

1,安裝pyinsatller

pip3 install pyinstaller

2,使用pyinstaller打包python程式

pyinstaller -f -w (-i icofile) filename

filename表示你的python程式檔名

-w 表示隱藏程式執行時的命令列視窗(不加-w會有黑色視窗)

括號內的為可選引數,-i icofile表示給程式加上圖示,圖示必須為.ico格式

icofile表示圖示的位置,

3,若引用了其它包,把該包檔案也放入該打包檔案下

pyinstaller 打包成可執行exe

虛擬環境安裝 pyinstaller pip install pyinstaller 打包exe命令 具體的命令網上資料很多 打包1個py檔案,並隱藏執行視窗 pyinstaller f w main.py 打包1個py檔案 f 並隱藏執行視窗 w 替換exe的ico圖示 i img.ico pyi...

python打包成exe可執行檔案

把做好的py檔案打包成exe 我們要用到pyinsatller這個包 安裝pyinsatller pip3 install pyinstaller例如我們的py 為 輸入兩個數,求兩個數之和。x input 請輸入第乙個數 y input 請輸入第二個數 z float x float y prin...

Python程式打包成EXE可執行檔案

pip3 install pyinstaller 在cmd開啟的command介面中,進入code所在目錄,執行以下命令 python pyinstaller.py opts yourprogram.py 其中 opts主要選項包括 命令解釋 f onefile 打包成乙個exe檔案 d onedi...