文章目录
- 1. 安装 pyinstaller
- 2. 终端执行打包
使用
./test /Users/xxx/imgs/selfie5.jpg
,成果:
(tensorflow) Robin-macbook-pro:dist robin$ ./test /Users/xxx/imgs/selfie5.jpg输入图像的图像大小:(height, width)=(3088, 2316)处理后的图像大小:(height, width)=(1280, 960)
话不多说直接上步骤:
1. 安装 pyinstaller
pip install pyinstaller
2. 终端执行打包
cd xxx
(脚本所在位置)pyinstaller -F xxx.py
(我的是 test.py)
在./dist文件夹下即可找到可执行程序
test 参数
即可(我的脚本需要输入参数)
几点 tips:
- Mac 上生成的可执行程序只能在其它 Mac上运行
- 也可以使用
pyinstaller -D
等参数(生成的是一个文件夹,-F
生成的是单个文件)