【问题标题】:Matplotlib backend error in spyder console?spyder控制台中的Matplotlib后端错误?
【发布时间】:2021-07-19 00:32:54
【问题描述】:

任何想法如何处理我的 spyder (5.0.0) 控制台中的以下错误?

Output from spyder call 'show_mpl_backend_errors':

=========================================================================
NOTE: The following error appeared when setting your Matplotlib backend!!
=========================================================================

Traceback (most recent call last):
  File "C:\Users\hana\anaconda3\lib\site-packages\spyder_kernels\console\kernel.py", line 735, in _set_mpl_backend
    get_ipython().run_line_magic(magic, backend)
  File "C:\Users\hana\AppData\Roaming\Python\Python38\site-packages\IPython\core\interactiveshell.py", line 2326, in run_line_magic
    result = fn(*args, **kwargs)
  File "<decorator-gen-109>", line 2, in matplotlib
  File "C:\Users\hana\AppData\Roaming\Python\Python38\site-packages\IPython\core\magic.py", line 187, in <lambda>
    call = lambda f, *a, **k: f(*a, **k)
  File "C:\Users\hana\AppData\Roaming\Python\Python38\site-packages\IPython\core\magics\pylab.py", line 99, in matplotlib
    gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui)
  File "C:\Users\hana\AppData\Roaming\Python\Python38\site-packages\IPython\core\interactiveshell.py", line 3431, in enable_matplotlib
    pt.activate_matplotlib(backend)
  File "C:\Users\hana\AppData\Roaming\Python\Python38\site-packages\IPython\core\pylabtools.py", line 320, in activate_matplotlib
    from matplotlib import pyplot as plt
  File "C:\Users\hana\anaconda3\lib\site-packages\matplotlib\pyplot.py", line 36, in <module>
    import matplotlib.colorbar
  File "C:\Users\hana\anaconda3\lib\site-packages\matplotlib\colorbar.py", line 44, in <module>
    import matplotlib.contour as contour
  File "C:\Users\hana\anaconda3\lib\site-packages\matplotlib\contour.py", line 17, in <module>
    import matplotlib.text as text
  File "C:\Users\hana\anaconda3\lib\site-packages\matplotlib\text.py", line 16, in <module>
    from .textpath import TextPath  # Unused, but imported by others.
  File "C:\Users\hana\anaconda3\lib\site-packages\matplotlib\textpath.py", line 11, in <module>
    from matplotlib.mathtext import MathTextParser
  File "C:\Users\hana\anaconda3\lib\site-packages\matplotlib\mathtext.py", line 27, in <module>
    from PIL import Image
  File "C:\Users\hana\AppData\Roaming\Python\Python38\site-packages\PIL\Image.py", line 94, in <module>
    from . import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (C:\Users\hana\AppData\Roaming\Python\Python38\site-packages\PIL\__init__.py)

我目前有matplotlib 3.3.4,尝试将设置从内联更改为自动并重新安装anaconda,但错误仍然存​​在:(

谢谢!

【问题讨论】:

    标签: python matplotlib anaconda backend spyder


    【解决方案1】:

    我再次卸载了 anaconda,然后从系统目录 (%appdata% & %programfiles%) 和 Windows 注册表中删除了所有剩余文件。

    再次安装后,错误消失了。 :)

    【讨论】:

    • 这里是 Spyder 维护者)我很高兴你能够自己解决这个问题。下次请避免使用pip 安装包,并删除此目录`C:\Users\hana\AppData\Roaming\Python`(不需要卸载Anaconda)。
    猜你喜欢
    • 1970-01-01
    • 2014-07-04
    • 2017-04-17
    • 2018-11-08
    • 1970-01-01
    • 2017-05-24
    • 2017-03-19
    • 2020-01-31
    • 1970-01-01
    相关资源
    最近更新 更多