close
Q. 如何將 Python 檔案編譯成 exe (執行檔)
*1 setup.py 檔案內容
參考文件:
- 下載與你使用的 Python 相對應的版本的 py2exe 編譯工具,並且安裝好它
- 準備 steup.py 檔案 (*1) 與 你要包裝的 python 檔案
- 打開 cmd line
- → python setup.py install
- → python setup.py py2exe
- 完成後會在 此路徑裡 產生出 dist 跟 build 二個資料夾,執行檔與所須的檔案全在 dist 裡。
*1 setup.py 檔案內容
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
hello.py 是指你寫好的 py 檔。
import py2exe
setup(console=['hello.py'])
hello.py 是指你寫好的 py 檔。
參考文件:
全站熱搜