1. 下载pyinstaller。
最新的pyinstaller版本为2.0版本,官方网站http://www.pyinstaller.org。下载链接:http://jaist.dl.sourceforge.net/project/pyinstaller/2.0/pyinstaller-2.0.zip
2. 安装
在Linux环境下只需要解压就可以使用。
3. 使用
pyinstaller_path/pyinstaller.py yourscript.py
命令完成后会在当前目录生成一个yourscript目录,里面有build目录,dist目录。dist目录里面还有一个yourscript目录,这个里面就是生成的可直接运行的程序和一些依赖的包了。
如果只想生成一个单一文件,就加上-F选项。
pyinstaller_path/pyinstaller.py -F yourscript.py
同样在dist目录下面会生成一个单一的可执行文件。