使用 PyInstaller,安裝方法
pip install pyinstaller
之后打開python安裝路徑中的
script文件夾,pyinstaller.exe應該就在這里面
打包方法,進入安裝pyinstaller.exe的文件夾中,運行
pyinstaller.exe -F 文件路徑/要打包的文件.py
然后目前這個文件夾里就會生成兩個文件夾 build 和 dist
dist里面就是打包好的exe程序
需要注意的是打包好的程序會比較大
運行的參數(shù)請參考官方鏈接
https://pyinstaller.readthedocs.io/en/v3.3.1/usage.html