將Python程式打包為exe方法

2022-09-20 04:45:10 字數 650 閱讀 5211

將python程式打包為exe檔案,需要使用到的工具是pyinstaller

pyinstaller是乙個多平台的python程式打包為exe的免費工具

安裝pyinstaller

1,在windows中,pyinstaller依賴pywin32,pypiwin32(linux,mac忽略)

如果在安裝pyinstaller時使用的是pip或者easy_install會自動pypwin32,只需要手動安裝pywin32即可

安裝命令:pip install pywin32

2,使用pip安裝pyinstaller

安裝命令:pip install pyinstaller

注意:手動安裝需要安裝pypiwin32

3,pyinstaller的使用

打包命令:pyinstaller -f py檔案路徑

打包成功後dist資料夾下就是exe了

pyinstaller把python打包成exe去掉黑窗doc視窗問題:

pyinstaller -f tools2.py --noconsole

或者pyinstaller -f -w example.py

直接打包:

pyinstaller -f -w example.py

將Python程式打包為exe

當python專案編碼完成之後,有時候我們需要讓其在沒有python環境的電腦上執行,此時我們就需要將python專案進行打包了,本篇文章主要是基於python的第三方庫pyinstaller進行的。使用pyinstaller打包python專案,相對於c和c 專案的打包要簡單很多。這個程式展示了使...

打包python檔案為exe程式 vscode

如果沒有在vscode終端輸入 pip3 install pyinstaller 安裝成功後下一步 2.在終端輸入打包命令 pyinstaller f test.py 打包成功後下一步 3.專案路徑下的dist資料夾中即可找到打包程式 1.找到python的安裝目錄,進入script目錄,鍵入 pi...

python打包exe程式

1.安裝py2exe 2.編寫setup.py 如下 coding utf 8 from distutils.core import setup import py2exe powered by includes options setup options options,description m...