Windows 下打包python 程序

python3.8.10

安装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

pack

需要安装的包

posted @ 2022-09-16 09:20  lambertlt  阅读(107)  评论(0)    收藏  举报