由于 Matplotlib 依赖 Cycler,无法运行 Python 代码

由于 Matplotlib 依赖 Cycler,无法运行 Python 代码

我有一个调用 matplotlib 的小型 Python 程序。看来这个库依赖于“Cycler”,这给了我这个错误:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import matplotlib.pyplot as plt
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-2.0.0+3318.g9e7e15b-py2.7-linux-x86_64.egg/matplotlib/__init__.py", line 1158, in <module>
    rcParams = rc_params()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-2.0.0+3318.g9e7e15b-py2.7-linux-x86_64.egg/matplotlib/__init__.py", line 1000, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-2.0.0+3318.g9e7e15b-py2.7-linux-x86_64.egg/matplotlib/__init__.py", line 1134, in rc_params_from_file
    if key not in _all_deprecated])
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-2.0.0+3318.g9e7e15b-py2.7-linux-x86_64.egg/matplotlib/__init__.py", line 891, in __init__
    self.update(*args, **kwargs)
  File "/usr/lib/python2.7/_abcoll.py", line 572, in update
    self[key] = value
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-2.0.0+3318.g9e7e15b-py2.7-linux-x86_64.egg/matplotlib/__init__.py", line 914, in __setitem__
    cval = self.validate[key](val)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib-2.0.0+3318.g9e7e15b-py2.7-linux-x86_64.egg/matplotlib/rcsetup.py", line 852, in validate_cycler
    cycler_inst.change_key(prop, norm_prop)
AttributeError: 'Cycler' object has no attribute 'change_key'

有人能帮我解决这个问题吗?

答案1

您需要更新循环器依赖项,运行以下代码:

pip install -U cycler

相关内容