我正在尝试使用cx_Freeze从.py to exe
进行转换
我做了一个setup.py
代码:
application_title = "Test_v_1.1"
main_python_file = "Test_V_1.py"
import sys
from cx_Freeze import setup,Executable
base = None
if sys.platform == "win32":
base ="Win32GUI"
includes=["atexit","re"]
setup(
name=application_title,
version = "0.1",
description ="Simle Test",
options={"build_exe":{"includes":includes}},
executables = {Executable(main_python_file, base = base)})
我将以下代码添加到我的setup.py and got the error
ImportError:DLL加载失败:找不到指定的模块。
import os
os.environ['TCL_LIBRARY'] = r'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\tcl\tk8.6'
我尝试使用pyinstaller,但是我的cmd犯了PyInstaller name not found
的错误,而我的python不想卸载pip 9.0.1陷入了我以另一种方式盯着的“卸载”阶段.py
答案 0 :(得分:0)
似乎您只是缺少DLL。尝试将它们包含在您的设置配置中。
include_files = [r"C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\DLLs\tcl86t.dll",
r"C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\DLLs\tk86t.dll"]
setup(
name=application_title,
version = "0.1",
description ="Simle Test",
options={"build_exe":{"includes":[],"include_files":include_files}},
executables = {Executable(main_python_file, base = base)})