天天看點

python3項目打包成exe可執行程式

使用pyinstaller将python檔案打包成exe程式,打包步驟如下:

一、安裝pyinstaller

(1)win+R輸入cmd,打開指令視窗

python3項目打包成exe可執行程式
python3項目打包成exe可執行程式

(2)安裝pyinstaller,安裝指令:pip install pyinstaller

python3項目打包成exe可執行程式

二、打包

1,切換到打包程式目錄

例:需要打包程式目錄為:D:\automation\autotest_tool\interface_param_change_tool

切換指令:cd D:\automation\autotest_tool\interface_param_change_tool

python3項目打包成exe可執行程式

2,打封包件,pyinstaller -F xxx.py(xxx.py,打包的檔案)

例,打封包件為:runer.py

python3項目打包成exe可執行程式
python3項目打包成exe可執行程式

3,到打封包件目錄檢視打包好的程式,并執行

(1)打包成功後項目中新增dist檔案

python3項目打包成exe可執行程式

(2)進入dist檔案,點選運作打包好的exe程式

python3項目打包成exe可執行程式