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目錄下面會生成一個單一的可執行文件。