Python解决AttributeError: module ‘matplotlib‘ has no attribute ‘get_data_path‘问题

import matplotlib.pyplot as plt时,
报错显示AttributeError: module 'matplotlib' has no attribute 'get_data_path'
请添加图片描述
检查了一下目前matplotlib的版本是3.4.3,出现包导入错误可能是系统或package升级的原因,多尝试一下降低package的版本就好。
试了一下3.3.1 和3.3.4版本,最后3.3.4版本可以完美解决上述报错~

  • 8
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
AttributeError: module 'matplotlib' has no attribute 'get_data_path'表示在使用matplotlib模块时,出现了找不到'get_data_path'这个属性的错误。要解决这个问题,可以尝试以下方法: 1. 检查matplotlib版本:确保你使用的是最新的matplotlib版本。你可以通过运行以下命令来升级matplotlib:`pip install --upgrade matplotlib`。 2. 检查引用:请确保你正确地引用了matplotlib模块。通常,应该使用`import matplotlib.pyplot as plt`来引用matplotlib并使用plt来调用其相关函数。 3. 检查安装:如果你已经安装了matplotlib库,但仍然出现此错误,请尝试重新安装matplotlib。你可以使用以下命令来卸载和重新安装matplotlib:`pip uninstall matplotlib`,然后`pip install matplotlib`。 如果你的问题是关于seq_loss.py文件中的另一个错误,即AttributeError: module 'tensorflow.compat.v1' has no attribute 'contrib',请确保你使用的是与该文件兼容的tensorflow版本。在较新的tensorflow版本中,"contrib"模块已被移除,因此你可能需要更新你的代码以适应最新版本的tensorflow。 请注意,在代码中的修改或更改版本之前,建议先备份代码,并仔细检查错误消息以确定确切的问题所在。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [AttributeError: modulematplotlib’ has no attribute ‘figure’](https://blog.csdn.net/xingleitinghai/article/details/125359390)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [AttributeError: module 'tensorflow.compat.v1' has no attribute '](https://download.csdn.net/download/qq_38766019/86272235)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值