天天看點

python通過pyinstaller庫将程式打包成可執行檔案python通過pyinstaller庫将py程式打包成可執行exe檔案

python通過pyinstaller庫将py程式打包成可執行exe檔案

1. 安裝pyinstaller庫

安裝方法可參考:python通過pip安裝第三方庫

2. 打包需要運作的主檔案:

  1. 找到需要打包的py主程式的路徑,如:D:\eclipse\myfunds\src\fundspaln.py
  2. 在cmd界面輸入指令:

    pyinstaller.exe -F D:\eclipse\myfunds\src\fundspaln.py --noconsole

    說明:

    1. pyinstaller.exe -F,-F參數一定要大寫,表示要打包生成exe檔案
    2. –noconsole,可以清除exe程式運作時出現的黑框
  3. 根據提示可在相應的dist檔案夾下找到exe檔案
    python通過pyinstaller庫将程式打包成可執行檔案python通過pyinstaller庫将py程式打包成可執行exe檔案