【问题标题】:Python Script is plotting but I stillketting an errorPython 脚本正在绘图,但我仍然出现错误
【发布时间】:2022-01-04 20:20:17
【问题描述】:

我在 Python 中提交了一个脚本,但最终得到了这个错误:

ImportError Traceback(最近一次调用)

~/grader/assignment1_student_solution.py in ()

300 

301 

--> 302 准确度绘图()

303 

304 

~/grader/assignment1_student_solution.py in accuracy_plot()

248 

249 def accuracy_plot():

--> 250 import matplotlib.pyplot as plt

251 

252     get_ipython().run_line_magic('matplotlib', 'notebook')

/opt/conda/lib/python3.6/site-packages/matplotlib/pyplot.py in ()

113 

114 from matplotlib.backends import pylab_setup

--> 115 _backend_mod,new_figure_manager,draw_if_interactive,_show = pylab_setup()

116 

117 _IP_REGISTERED = None

/opt/conda/lib/python3.6/site-packages/matplotlib/backends/init.py in pylab_setup()

 30     # imports. 0 means only perform absolute imports.

 31     backend_mod = __import__(backend_name,

---> 32 个 globals(),locals(),[backend_name],0)

 33 

 34     # Things we pull in from all backends

/opt/conda/lib/python3.6/site-packages/matplotlib/backends/backend_qt5agg.py in ()

 14 

 15 from .backend_agg import FigureCanvasAgg

---> 16 从 .backend_qt5 导入 QtCore

 17 from .backend_qt5 import QtGui

 18 from .backend_qt5 import FigureManagerQT

/opt/conda/lib/python3.6/site-packages/matplotlib/backends/backend_qt5.py in ()

 24 

 25 from matplotlib.widgets import SubplotTool

---> 26 import matplotlib.backends.qt_editor.figureoptions as figureoptions

 27 

 28 from .qt_compat import (QtCore, QtGui, QtWidgets, _getSaveFileName,

/opt/conda/lib/python3.6/site-packages/matplotlib/backends/qt_editor/figureoptions.py in ()

 18 import matplotlib

 19 from matplotlib import cm, markers, colors as mcolors

---> 20 导入matplotlib.backends.qt_editor.formlayout为formlayout

 21 from matplotlib.backends.qt_compat import QtGui

 22 

/opt/conda/lib/python3.6/site-packages/matplotlib/backends/qt_editor/formlayout.py in ()

 54 

 55 from matplotlib import colors as mcolors

---> 56 from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore

 57 

 58 

/opt/conda/lib/python3.6/site-packages/matplotlib/backends/qt_compat.py in ()

126     if QT_API == QT_API_PYQT5:

127         try:

--> 128 from PyQt5 import QtCore, QtGui, QtWidgets

129             _getSaveFileName = QtWidgets.QFileDialog.getSaveFileName

130         except ImportError:

ImportError: libGL.so.1: cannot open shared object file: No such file or directory

【问题讨论】:

  • 1/ 可以使用单个代码块来增强演示文稿 2/ 提供重新创建问题的代码 sn-p。

标签: python matplotlib anaconda


【解决方案1】:

你好像少了libGL.so

libGL.so 可以在许多软件包中找到,具体取决于您的显卡。见here

选择适合您的显卡的软件包并使用:

sudo apt-get install <package-name>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-06
    • 1970-01-01
    • 1970-01-01
    • 2015-12-19
    • 1970-01-01
    • 1970-01-01
    • 2019-07-09
    • 2019-06-01
    相关资源
    最近更新 更多