gpt4 book ai didi

python - 导入 matplotlib.pyplot 作为 plt 失败

转载 作者:行者123 更新时间:2023-12-01 09:01:00 31 4
gpt4 key购买 nike

File "<stdin>", line 1, in <module>
File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 32, in <module>
import matplotlib.colorbar
File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\colorbar.py", line 32, in <module>
import matplotlib.contour as contour
File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\contour.py", line 18, in <module>
import matplotlib.font_manager as font_manager
File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1363, in <module>
_rebuild()
File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1344, in _rebuild
fontManager = FontManager()
File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 978, in __init__
ttffiles = findSystemFonts(paths) + findSystemFonts()
File "C:\Users\franc\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 264, in findSystemFonts
fontfiles.update(win32InstalledFonts(fontext=fontext))
TypeError: 'NoneType' object is not iterable

我尝试通过多种方式卸载并重新安装matplotlib,但仍然出现上述错误。

最佳答案

我遇到了这个问题并通过安装旧版本修复了它。尝试:

pip 卸载 matplotlib

pip install -v matplotlib==2.2.2

这个bug似乎是由于matplotlib.font_manager.py中错误使用pathlib包引起的

关于python - 导入 matplotlib.pyplot 作为 plt 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52458461/

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