我有一个使用Graphiz模块的python程序,程序的输出使用Graphviz windows安装来创建图像。 我的程序适用于普通的Windows用户,我的目标是提供一个msi安装程序。 我没有问题使用cx_Freeze包装我的python模块并在之后运行结果... 问题是,程序依赖于已安装的Graphviz目录来从我的程序输出创建图像而且dir的bin文件夹应该在系统路径中....
如果有使用cx_Freeze的解决方案(我试过但没找到) 请帮助我 如果不是请咨询我如何规避这个问题
万分感谢!
import sys, os
from cx_Freeze import setup, Executable
build_exe_options = {"packages": ["PIL.Image",
"tkinter",
"graphviz",
"Rec_FFT",
"graph_visualization",
"math",
"cmath"],
"include_files": [
r"D:\Yigal\Python36-32\DLLs\tcl86t.dll",
r"D:\Yigal\Python36-32\DLLs\tk86t.dll"],
}
base = None
if sys.platform == "win32":
base = "Win32GUI"
# pass # base=None is for console apps
os.environ['TCL_LIBRARY'] = r'D:\Yigal\Python36-32\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'D:\Yigal\Python36-32\tcl\tk8.6'
setup(name="FFTCalc",
version="0.1",
description="# Rec FFT Calc #",
options={
"build_exe": build_exe_options
},
executables=[Executable("Rec_FFT_GUI.py", base=base)])
这是未安装Graphiz时的输出:
graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tjpeg', '-O', 'FFT_RESULTS\\graph'], make sure the Graphviz executables are on your systems' PATH
我可以看到它缺少dot.exe ...但是如何用cx_Freeze打包?