0
我是Python的新手,我正在運行Python 3.6。嘗試使用cx_freeze和下面的代碼在名爲「setup.py」的文件中構建可執行文件。我把程序的python腳本和圖標文件放在python主目錄文件夾中。當我在命令提示符中輸入「python setup.py build」時,它會顯示「正在運行構建」,然後立即生成新的命令提示符。沒有錯誤,但之後我無法找到任何exe文件。我究竟做錯了什麼?我是否在錯誤的地方搜索exe文件,或者在沒有提供錯誤信息的情況下編譯失敗?使用cx_freeze找不到exe文件
import cx_Freezefrom cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages = ["numpy","tkinter"], excludes = [],includes = ["numpy","tkinter"],
include_files = ["battleship.ico"])
import sys
base = 'Win32GUI' if sys.platform=='win32' else None
executables = [
Executable('battleship.py', base=base)
]
setup(
name='Battleship',
version = '1.0',
description = 'A PvC Battleship Game',
options = dict(build_exe = buildOptions),
executables = executables
)
僅供參考,我看到第一行是不正確,但用「從cx_Freeze導入安裝程序,可執行文件」替換該行會產生相同的結果。 – SethBorgo