我正在尝试在Ubuntu上使用import matplotlib。我从源代码重新安装了matplotlib,因为我无法使用TkAgg后端。现在,我面临着一个新问题,我无法解决,也无法在任何地方找到解决方案。我正在使用Python 3.5。
运行简单导入时出现此错误,向我显示:

Traceback (most recent call last):
  File "plot_test.py", line 17, in <module>
    import matplotlib
  File "/usr/local/lib/python3.5/site-packages/matplotlib-2.0.0b3+1955.g888bf17-py3.5-linux-x86_64.egg/matplotlib/__init__.py", line 1174, in <module>
    rcParams = rc_params()
  File "/usr/local/lib/python3.5/site-packages/matplotlib-2.0.0b3+1955.g888bf17-py3.5-linux-x86_64.egg/matplotlib/__init__.py", line 1017, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File "/usr/local/lib/python3.5/site-packages/matplotlib-2.0.0b3+1955.g888bf17-py3.5-linux-x86_64.egg/matplotlib/__init__.py", line 1149, in rc_params_from_file
    config = RcParams([(key, default) for key, (default, _) in iter_params
  File "/usr/local/lib/python3.5/site-packages/matplotlib-2.0.0b3+1955.g888bf17-py3.5-linux-x86_64.egg/matplotlib/__init__.py", line 901, in __init__
    self[k] = v
  File "/usr/local/lib/python3.5/site-packages/matplotlib-2.0.0b3+1955.g888bf17-py3.5-linux-x86_64.egg/matplotlib/__init__.py", line 918, in __setitem__
    cval = self.validate[key](val)
  File "/usr/local/lib/python3.5/site-packages/matplotlib-2.0.0b3+1955.g888bf17-py3.5-linux-x86_64.egg/matplotlib/rcsetup.py", line 844, in validate_cycler

    cycler_inst.change_key(prop, norm_prop)
AttributeError: 'Cycler' object has no attribute 'change_key'

我认为这可能与从rcsetup.py导入循环程序有关,因为有一条评论说:
# Don't let the original cycler collide with our validating cycler

那么原始的东西与他们的骑自行车者发生了冲突吗?

我怎样才能解决这个问题?有什么建议么?谢谢!

最佳答案

刚刚检查了循环仪的版本,它已经过时了。只需更新循环器
sudo pip3 install --upgrade cycler
或者
sudo -H python3 -m pip install --upgrade cycler

关于python - AttributeError : 'Cycler' object has no attribute 'change_key' ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38858407/

10-12 18:20