这个问题与前面的问题here完全相同。我在2022年9月20日安装了python3.9或3.10和matplotlib 3.6.0,下面有一个错误。Gaff也有同样的错误。我怎样才能解决这个问题?
Matplotlib support failed
Traceback (most recent call last):
File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 25, in do_import
succeeded = activate_func()
File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_code_executor.py", line 29, in <lambda>
"matplotlib": lambda: activate_matplotlib(self.enableGui),
File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py", line 110, in activate_matplotlib
gui, backend = find_gui_and_backend()
File "C:\Users\G\AppData\Roaming\JetBrains\IdeaIC2022.2\plugins\python-ce\helpers\pydev\pydev_ipython\matplotlibtools.py", line 47, in find_gui_and_backend
backend = matplotlib.rcParams['backend']
File "D:\books\programming\python17\lib\site-packages\matplotlib\__init__.py", line 677, in __getitem__
plt.switch_backend(rcsetup._auto_backend_sentinel)
File "D:\books\programming\python17\lib\site-packages\matplotlib\pyplot.py", line 251, in switch_backend
switch_backend(candidate)
File "D:\books\programming\python17\lib\site-packages\matplotlib\pyplot.py", line 266, in switch_backend
canvas_class = backend_mod.FigureCanvas
AttributeError: partially initialized module 'matplotlib.backends.backend_macosx' has no attribute 'FigureCanvas' (most likely due to a circular import)
Process finished with exit code 0发布于 2022-09-21 10:01:07
我的解决方案只是添加‘导入matplotlib’,如下所示。
import matplotlib
import matplotlib.pyplot as plt那么代码就像一种符咒。如果删除“导入matplotlib”行,则会再次发生错误。我认为这不是一个合适的答案,因为我需要在每个代码中添加‘导入matplotlib’。
另一台计算机中的matplotlib的上一版本没有此问题。我的猜测是,新的3.6.0版本可能有一个bug。
请分享另一个聪明的解决方案,以更容易解决这个问题。
https://stackoverflow.com/questions/73798855
复制相似问题