当前位置:   article > 正文

AttributeError: module ‘matplotlib‘ has no attribute ‘get_data_path‘_attributeerror: module 'matplotlib' has no attribu

attributeerror: module 'matplotlib' has no attribute 'use

【报错】使用 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'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

【原因】上文安装的库重新安装了指定版本的 matplotlib 库,安装完成后没有重启。

【解决办法】重启内核即可 1

在这里插入图片描述


  1. AttributeError: module ‘matplotlib’ has no attribute ‘get_data_path’ when running result.plot() ↩︎

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码探险家/article/detail/884308
推荐阅读
相关标签
  

闽ICP备14008679号