PyInstaller官方网站:http://www.pyinstaller.org/
PyInstaller Gitee:https://gitee.com/mirrors/pyinstaller
在开发一些小工具给他人使用时,他人的系统中可能并没有安装python环境或没有安装相应的第三方库,要求对方安装不怎么现实,特别是对方不是技术人员的时候,此时将开发好的脚步通过pyinstaller打包成一个可执行文件是个不错的选择。
pyinstaller本身可以跨平台使用,但这里的跨平台指的是pyinstaller本身,通过pyinstaller打包出来的文件是无法跨平台的,在MacOS下使用pyinstaller打包python程序,打包后的内容只可在MacOS下运行,在windwos下打包的python程序,只可在Windows下运行。
使用pip命令安装:pip install pywin32
使用pip命令安装:pip install pyinstaller
python pyinstaller.py -F myfile.py
pyinstaller -F myfile.py
pyinstaller最重要的两个参数就是-F与-D参数
Ps:不指定依赖库无法打包应用程序。
综上所述,最常用的命令为:
分级拉动命令如下: