Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Tkinter、matplotlib.figure和pyinstaller时出现问题_Python_Matplotlib_Tkinter_Pyinstaller - Fatal编程技术网

Python 使用Tkinter、matplotlib.figure和pyinstaller时出现问题

Python 使用Tkinter、matplotlib.figure和pyinstaller时出现问题,python,matplotlib,tkinter,pyinstaller,Python,Matplotlib,Tkinter,Pyinstaller,我正在编写一个程序,从化学平衡反应中获取数据,并使用以下代码在tkinter中绘制它: f = Figure(figsize=(5, 4), dpi=100) PLT = f.add_subplot(111) if qdados == 1: PLT.plot(points[0], points[1], label=f'{specie[0]}', color='blue') if 'T' in spec

我正在编写一个程序,从化学平衡反应中获取数据,并使用以下代码在tkinter中绘制它:

        f = Figure(figsize=(5, 4), dpi=100)
        PLT = f.add_subplot(111)
        if qdados == 1:
            PLT.plot(points[0], points[1], label=f'{specie[0]}', color='blue')
            if 'T' in specie:
                f.supylabel("Temperatura")
            if 'T' not in specie:
                f.supylabel("Moles")
            f.suptitle('CHON + HON')
            f.supxlabel("phi")
我使用matplotlib.figure.figure将绘图放在tkinter中,不需要知道整个代码。一切正常。我的代码在Pycharm(venv)中运行正常,但当我将其转换为.exe时,会出现以下问题:

Exception in Tkinter callback
Traceback (most recent call last):
  File "tkinter\__init__.py", line 1884, in __call__
  File "main.py", line 1343, in window2
    f.supxlabel('phi')
AttributeError: 'Figure' object has no attribute 'supxlabel'
我认为它正在导入模块matplotlib.figure.figure,但它没有导入对象supxlabelsupylabel和其他对象。 通过此转换,我获得了matplotlib缺少的这些报告:

missing module named matplotlib.tri.Triangulation - imported by matplotlib.tri (top-level), matplotlib.tri.trifinder (top-level), matplotlib.tri.tritools (top-level), matplotlib.tri.triinterpolate (top-level)
missing module named matplotlib.axes.Axes - imported by matplotlib.axes (delayed), matplotlib.legend (delayed), matplotlib.projections.geo (top-level), matplotlib.projections.polar (top-level), mpl_toolkits.mplot3d.axes3d (top-level), matplotlib.figure (top-level), matplotlib.pyplot (top-level)
有很多缺少的模块,但它们不会影响我的代码,只影响图中的对象supxlabel、supylabel和其他对象。我认为这些对象在matplotlib中是新的,也许pyinstaller尚未构建以包含它们。所以问题是:如何让pyinstaller包含它们?