Erm*_*ite 9 python kernel matplotlib visual-studio-code jupyter-notebook
当我想在 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'
Run Code Online (Sandbox Code Playgroud)
但是,如果我在导航器的 jupyter-notebook 上尝试相同的代码,则不会出现此错误。所以我不明白为什么会出现这个错误,因为两个笔记本都在安装了 matplotlib 3.3.1 版本的同一个内核下运行。
如果有人能给我任何启示,我将不胜感激。:)
小智 1
我遇到了同样的问题,因为我使用了错误的 python 内核。我在使用标准 python 内核时遇到了这个问题,但在使用虚拟环境(这是我通常使用的)时却没有。
| 归档时间: |
|
| 查看次数: |
6660 次 |
| 最近记录: |