Q. 如何將 Python 檔案編譯成 exe (執行檔)
  1. 下載與你使用的 Python 相對應的版本的 py2exe 編譯工具,並且安裝好它
  2. 準備 steup.py 檔案 (*1) 與 你要包裝的 python 檔案
  3. 打開 cmd line
  4. → python setup.py install
  5. → python setup.py py2exe
  6. 完成後會在 此路徑裡 產生出 dist 跟 build 二個資料夾,執行檔與所須的檔案全在 dist 裡。

*1  setup.py 檔案內容

from distutils.core import setup
import py2exe
setup(console=['hello.py'])

hello.py 是指你寫好的 py 檔。

參考文件:

arrow
arrow
    全站熱搜

    雪 薄草 發表在 痞客邦 留言(0) 人氣()