pyinstaller 打包Python项目¶ 概要: 使用pyinstaller打包Python项目为可执行文件(测试平台 macOS 10.15) 创建时间: 2022.09.28 23:40:53 更新时间: 2023.07.28 22:42:15 安装pyinstaller¶ Bash1pip install pyinstaller 清理残存文件¶ 此步骤是为了避免旧的打包目录对本次打包的影响 Bash1 2cd $python_project_dir sudo rm -rf build dist 执行打包操作¶ 打包为一个可执行文件 Bash1sudo pyinstaller -F -w main.py 运行软件¶ 进入dist目录,双击对应的.app文件即可 参考¶ Using PyInstaller — PyInstaller 4.7 documentation mac 安装pyinstaller 并打包