【问题标题】:cannot import name 'animation' from partially initialized module 'matplotlib'无法从部分初始化的模块“matplotlib”导入名称“动画”
【发布时间】:2021-02-21 03:03:10
【问题描述】:

代码:

from matplotlib import animation

输出:

ImportError: cannot import name 'animation' from partially initialized module 'matplotlib' (most likely due to a circular import)

motplotlib 版本是 3.3.4

【问题讨论】:

  • 试试这个:from matplotlib.animation import FuncAnimation
  • ... 或 import matplotlib.animation as animation

标签: python matplotlib matplotlib-animation


【解决方案1】:

使用 pip install --upgrade matplotlib 简单地更新 matplotlib 对我有用。

【讨论】:

    【解决方案2】:

    追查文件路径后终于解决了问题,我一直在用Anaconda的spyder,所以我用anaconda提示一遍又一遍卸载安装matplotlib,但是问题不是anaconda报错,而是python37 idle,似乎如果在idle中安装了一个packege,spyder会先运行那个(在我的情况下这是一个坏的),只需删除python37 idle中的matplotlib,问题终于解决了

    【讨论】:

      【解决方案3】:

      执行全新安装:

      pip uninstall matplotlib 
      pip install matplotlib --force-reinstall --user
      

      【讨论】:

        猜你喜欢
        • 2022-07-27
        • 2020-11-21
        • 1970-01-01
        • 2020-07-21
        • 2021-04-03
        • 2021-12-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多