如何修复ufunc'isfinite'的类型错误?

2024-09-23 06:33:27 发布

您现在位置:Python中文网/ 问答频道 /正文

回溯如下。我不完全确定这意味着什么错误,我必须在哪里修复它

Traceback (most recent call last):
  File "/home/william/SOFTX-D-16-00075-master/runGsolve.py", line 1775, in <module>
    dmw = DesignerMainWindow()
  File "/home/william/SOFTX-D-16-00075-master/runGsolve.py", line 45, in __init__
    self.setupUi(self)
  File "/home/william/SOFTX-D-16-00075-master/GsolveGUIv3.py", line 410, in setupUi
    self.mplwidget = MatplotlibWidget(self.frame_14)
  File "/usr/local/lib/python3.6/dist-packages/pyqtgraph/widgets/MatplotlibWidget.py", line 34, in __init__
    self.fig = Figure(size, dpi=dpi)
  File "/home/william/.local/lib/python3.6/site-packages/matplotlib/figure.py", line 348, in __init__
    if not np.isfinite(figsize).all():
TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

最后一个调用中第348行的代码来自matplotlib,如下所示

        if not np.isfinite(figsize).all():
            raise ValueError('figure size must be finite not '
                             '{}'.format(figsize))
        self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)

Tags: theinpyselfmasterhomeinitline