【发布时间】:2017-02-14 14:41:07
【问题描述】:
我是 Python 新手。我正在尝试使用 cx_freeze 创建可执行文件,但创建文件后无法启动 exe。我收到以下错误:
我正在使用 pytone 3.6.0
代码
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)])
我尝试了我在互联网上找到的所有内容,但无法让这个 exe 工作。 在 Python 3.6 中是否有其他可能从 py 创建 exe?
【问题讨论】:
-
你试过这个解决方案吗 - stackoverflow.com/a/42357202/7046074.
标签: executable cx-freeze