2
私はPythonを初めて使用しています。私はcx_freezeで実行可能ファイルを作成しようとしていますが、ファイルが作成された後にexeを起動することはできません。私はpytone 3.6.0cx Freeze実行可能ファイルがありません_tkinter#これが失敗した場合、pythonがtk用に設定されていない可能性があります
コード
import sys
import os
os.environ['TCL_LIBRARY'] = "C:\\Users\\Valeri\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Users\\Valeri\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tk8.6"
from cx_Freeze import setup, Executable
# replaces commandline arg 'build'
sys.argv.append("build")
# change the filename to your program file --->
filename = "SolutionGenerator.py"
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(
name = "Circle",
version = "1.0",
description = "cx_Freeze Tkinter script",
executables = [Executable(filename, base=base)])
setup.py
を使用しています:私は次のエラーを取得しています
import sys import os os.environ['TCL_LIBRARY'] = "C:\\Users\\Valeri\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tcl8.6" os.environ['TK_LIBRARY'] = "C:\\Users\\Valeri\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tk8.6" from cx_Freeze import setup, Executable "SolutionGenerator.py" base = None if sys.platform == "win32":
base = "Win32GUI" setup(
name = "Circle",
version = "1.0",
description = "cx_Freeze Tkinter script",
executables = [Executable(filename, base=base)])
申し訳ありません申し訳ありません初期の投稿で間違いました。コードは実際にある:Tkinterのインポート* から Tkinterのインポートメッセージボックス 輸入ランダム メッセージ= [ 'рекриейтнитамнещо!'、] #1答=(メッセージ[random.randint(0、LEN(メッセージ)から - 1 )]) トップ= Tkの() top.title( "ランダムでたらめゲン") top.geometry( "200x180") デフhelloCallBack(): MSG = messagebox.showinfo( "ショット!"、(メッセージBOOT(top、text = "Blind shot me now!"、command = helloCallBack) B.config(height = 3、width = 1))) 15) B.place(x = 50、y = 50) top.mainloop() – Val
この解決策を試したことがありますか? - https://stackoverflow.com/a/42357202/7046074 –