[英]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.