赞
踩
【报错】使用 AutoDL 下 Notebook 调用 matplotlib 时遇到 AttributeError: module 'matplotlib' has no attribute 'get_data_path'
报错:
--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) /tmp/ipykernel_1156/517952973.py in <module> 2 import skimage 3 import IPython.display ----> 4 import matplotlib.pyplot as plt 5 from PIL import Image 6 import numpy as np ~/miniconda3/lib/python3.8/site-packages/matplotlib/__init__.py in <module> 821 # triggering resolution of _auto_backend_sentinel. 822 rcParamsDefault = _rc_params_in_file( --> 823 cbook._get_data_path("matplotlibrc"), 824 # Strip leading comment. 825 transform=lambda line: line[1:] if line.startswith("#") else line, ~/miniconda3/lib/python3.8/site-packages/matplotlib/cbook/__init__.py in _get_data_path(*args) 532 ``*args`` specify a path relative to the base data path. 533 """ --> 534 return Path(matplotlib.get_data_path(), *args) 535 536 AttributeError: module 'matplotlib' has no attribute 'get_data_path'
【原因】上文安装的库重新安装了指定版本的 matplotlib 库,安装完成后没有重启。
【解决办法】重启内核即可 1:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。