简体   繁体   English

导入 matplotlib.backends.backend_tkagg - ModuleNotFoundError:没有名为“PIL”的模块

[英]import matplotlib.backends.backend_tkagg - ModuleNotFoundError: No module named 'PIL'

I am using python 3.8.5 and running on Windows 10. I tried to insert a plot in Tkinter Gui, but when I import matplotlib.backends.backend_tkagg , it raises the error shown below.我正在使用 python 3.8.5 并在 Windows 10 上运行。我试图在 Tkinter Gui 中插入一个 plot,但是当我导入matplotlib.backends.backend_tkagg时,它引发了如下所示的错误。 Mathplotlib and Tkinter versions are the latest versions 8.6 and 3.3.1, respectively. Mathplotlib 和 Tkinter 版本分别是最新版本 8.6 和 3.3.1。 And I also installed the "Pillow" module.我还安装了“枕头”模块。

image showing the error显示错误的图像

>>>import matplotlib.backends.backend_tkagg

Here also is the error -这也是错误 -

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 1, in <module>
    from . import _backend_tk
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\backends\_backend_tk.py", line 15, in <module>
    from matplotlib.backend_bases import (
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\backend_bases.py", line 45, in <module>
    from matplotlib import (
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\textpath.py", line 11, in <module>
    from matplotlib.mathtext import MathTextParser
  File "C:\Users\User\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\mathtext.py", line 27, in <module>
    from PIL import Image
ModuleNotFoundError: No module named 'PIL'

If you are using anaconda try如果您使用的是 anaconda,请尝试

conda install pillow

if you are using pip try:如果您使用的是 pip,请尝试:

pip install Pillow

Make sure you are installing to the right environment.确保安装到正确的环境。 The import should then work.然后导入应该工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 matplotlib.backends.backend_tkagg 为“blit”引发属性错误 - matplotlib.backends.backend_tkagg is throwing an attribute error for 'blit' 无法导入 PIL ModuleNotFoundError: No module named &#39;PIL&#39; - can not import PIL ModuleNotFoundError: No module named 'PIL' ModuleNotFoundError:从 pyinstaller 运行 exe 时没有名为“matplotlib.backends.backend_svg”的模块 - ModuleNotFoundError: No module named 'matplotlib.backends.backend_svg' when running exe from pyinstaller 关闭/解压缩对象“ matplotlib.backends.backend_tkagg.FigureCanvasTkAgg” - Close/Unpack Object “matplotlib.backends.backend_tkagg.FigureCanvasTkAgg” 导入错误:没有名为 backend_tkagg 的模块 - ImportError: No module named backend_tkagg 从 matplotlib.backends 导入 _tkagg 导入错误:无法导入名称 _tkagg - from matplotlib.backends import _tkagg ImportError: cannot import name _tkagg 当我尝试运行“import matplotlib.pyplot as plt”时,我收到以下错误:“ModuleNotFoundError: No module named 'PIL'” - When I try to run “import matplotlib.pyplot as plt”, I receive the following error: “ModuleNotFoundError: No module named 'PIL'” Python - 将图像导入为 PIL_Image ModuleNotFoundError:没有名为“图像”的模块 - Python - import Image as PIL_Image ModuleNotFoundError: No module named 'Image' ModuleNotFoundError:没有名为“PIL”的模块,ImageTk - ModuleNotFoundError: No module named 'PIL', ImageTk ModuleNotFoundError:没有名为“joblib._parallel_backends”的模块 - ModuleNotFoundError: No module named 'joblib._parallel_backends'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM