相关疑难解决方法(0)

如何在使用 matplotlib 的情况下使用 pyinstaller

我有这个脚本,我将一个 GUI 附加到它的前面,并希望将它分发给其他 DnD DM,以便他们用于将网格覆盖到图像上。唯一的问题是,每次我尝试使用 Pyinstaller 打包 python 脚本时,它都会抛出两个不同的错误。如果我运行pyinstaller --hidden-import matplotlib myscript.py它返回

    NameError: name 'defaultParams' is not defined
    [7532] Failed to execute script ImageGridder
Run Code Online (Sandbox Code Playgroud)

因此,我决定尝试使用该--onefile选项再次运行该命令。当我这样做时,它返回,

   RuntimeError: Could not find the matplotlib data files
   [18884] Failed to execute script ImageGridder
Run Code Online (Sandbox Code Playgroud)

现在,在这两个示例中,打包过程都完成了,所有文件似乎都已正确生成。只是当我运行它生成的 .exe 时,它​​崩溃了。我知道文件本身运行正常,因为我已经让它在我的台式机和笔记本电脑上正常运行和工作。我已经做了好几个小时的搜索,寻找任何有帮助的东西,但似乎没有任何效果。剧本本身,

from PIL import Image
import tkinter as tk
from tkinter import filedialog
import matplotlib.pyplot as PLT
import matplotlib.ticker as plticker

class gridder(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)
        self.initialize()

    def initialize(self):        
        self.iWidth = tk.StringVar()
        self.iHeight = tk.StringVar() …
Run Code Online (Sandbox Code Playgroud)

python matplotlib pyinstaller

7
推荐指数
2
解决办法
9668
查看次数

标签 统计

matplotlib ×1

pyinstaller ×1

python ×1