gpt4 book ai didi

python - 错误 : from matplotlib import _png ImportError: cannot import name '_png' from 'matplotlib' (C:\\Garden\lib\site-packages\matplotlib\__init__. py)

转载 作者:行者123 更新时间:2023-12-04 03:57:25 25 4
gpt4 key购买 nike

我想使用 garden.matplotlib.FigureCanvas,但我每次都会遇到同样的问题。我安装了 matplotlibgardenkivy(单独)。所有库安装工作,除了 matplotlib.backend_kivyagg
我从 kivy 下载了一个文件用于测试 ( https://github.com/kivy-garden/garden.matplotlib )。这里的错误:

-----------------------------------------------------------------------------------   
Traceback (most recent call last):
File "C:/Users/alidi/OneDrive/Desktop/Garden/garden.matplotlib/garden.matplotlib-master/examples/test_backend.py", line 10, in <module>
from kivy.garden.matplotlib.backend_kivyagg import FigureCanvas,\
File "C:\Users\alidi\Desktop\Data_analysis_book_\Garden\lib\site-packages\kivy\garden\__init__.py", line 180, in load_module
return self._load_module(fullname, moddir)
File "C:\Users\alidi\Desktop\Data_analysis_book_\Garden\lib\site-packages\kivy\garden\__init__.py", line 183, in _load_module
mod = imp.load_module(fullname, None, moddir,
File "C:\Users\alidi\AppData\Local\Programs\Python\Python38-32\lib\imp.py", line 244, in load_module
return load_package(name, filename)
File "C:\Users\alidi\AppData\Local\Programs\Python\Python38-32\lib\imp.py", line 216, in load_package
return _load(spec)
File "C:\Users\alidi\.kivy\garden\garden.matplotlib\__init__.py", line 1, in <module>
from kivy.garden.matplotlib.backend_kivy import FigureCanvasKivy,\
File "C:\Users\alidi\.kivy\garden\garden.matplotlib\backend_kivy.py", line 256, in <module>
from matplotlib import _png
ImportError: cannot import name '_png' from 'matplotlib' (C:\Users\alidi\Desktop\Data_analysis_book_\Garden\lib\site-packages\matplotlib\__init__.py)

Process finished with exit code 1

最佳答案

在python 3.7, kivy==2.0.0, kivy-garden==0.1.4, matplotlib==3.4.1 有同样的问题。降级 matplotlib 解决了问题:

pip install matplotlib==3.1.1

关于python - 错误 : from matplotlib import _png ImportError: cannot import name '_png' from 'matplotlib' (C:\\Garden\lib\site-packages\matplotlib\__init__. py),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63615033/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com