Windows 下打包python 程序
安装pip3 install pyinstaller
执行打包命令 pyinstaller-F setup.py
Pyinstaller -F setup.py # 打包exe
pyinstaller -F -w --onefile --additional-hooks-dir=. --icon=D:/live_assistant/ControllerIcon.ico -n 抖音直播助手 Controller.py
pyinstaller -F --onefile --additional-hooks-dir=. Controller.py
pyinstaller --onefile --add-data "D:/live_assistant/data.json;." --additional-hooks-dir=. Controller.py
pyinstaller -F --add-data "./data.json;." --add-data "Tools.py;." .\Controller.py # 携带多文件打包
Pyinstaller -F -w setup.py # 不带控制台的打包
Pyinstaller -F -w -i xx.ico setup.py # 打包指定exe图标打包
Pyinstaller -F -w -i xx.ico setup.py --additional-hooks-dir=. # 当用到拖拽文件库的时候用
如何打最小包
# 建立虚拟环境
pipenv install
#进入虚拟环境
pipenv shell
# 安装模块
pip install test.py
# 打包的模块也要安装
pip install pyinstaller
# 开始打包
pyinstaller -Fw ./test.py
需要安装的包

有什么不同见解可以在评论区共同讨论

浙公网安备 33010602011771号