我试图冻结一个基于控制台的程序matplotlib.pyplot生成和保存绘图。(我不需要在保存之前预览或查看绘图。)以下是我的设置.py脚本:
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = "C:\\Program Files\\Anaconda3\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Program Files\\Anaconda3\\tcl\\tk8.6"
setup(name='FLOUResence.exe',
version='0.1',
options = {"build_exe": {"packages":["pandas", "numpy", "scipy", "matplotlib"]}
},
executables = [Executable(script='caller.py', targetName='FLOUResence.exe',
icon="icon.ico", base='Console')]
)
我可以编译程序,但当我运行绘图模块时,它返回以下错误:
This application failed to start because it could not find or load the Qt platform plugin "windows" in "".
Reinstalling the application may fix this problem.
据我所知,因为matplotlib希望加载/使用qtgui,但因为它是一个控制台应用程序,cx斨u freeze不能加载Qt?这是对问题的正确解释吗?对如何解决这个问题有什么想法吗?在
您需要将Qt平台插件添加到您的分发目录中。尝试一下,将PyQt安装的
Library\plugins\platforms
复制到package/dist
目录中。如果这对您有效,您可以在include_files
构建选项中添加目录。我使用miniconda,所以platforms目录在c:\miniconda\Library\plugins
。在相关问题 更多 >
编程相关推荐