【发布时间】:2020-12-28 18:59:40
【问题描述】:
当我想在 Visual Studio 的 jupyter-notebook 上导入 matplotlib.pyplot 时出现以下错误。
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in
----> 1 import matplotlib.pyplot as plt
~/miniconda3/envs/firstSteps/lib/python3.8/site-packages/matplotlib/__init__.py in
903 # triggering resolution of _auto_backend_sentinel.
904 rcParamsDefault = _rc_params_in_file(
--> 905 cbook._get_data_path("matplotlibrc"),
906 # Strip leading comment.
907 transform=lambda line: line[1:] if line.startswith("#") else line,
~/.local/lib/python3.8/site-packages/matplotlib/cbook/__init__.py in _get_data_path(*args)
AttributeError: module 'matplotlib' has no attribute 'get_data_path'
但如果我在导航器的 jupyter-notebook 上尝试相同的代码,则不会出现此错误。 所以我不明白为什么会出现这个错误,因为两个笔记本都在同一个内核下运行,并且安装了 matplotlib 3.3.1 版本。
如果有人能给我任何启示,我将不胜感激。 :)
【问题讨论】:
标签: python matplotlib visual-studio-code jupyter-notebook kernel