2016-08-09 211 views
3

我想在Ubuntu上使用import matplotlib。我從源碼重新安裝了matplotlib,因爲我無法使用TkAgg後端。現在我正面臨一個我無法解決的新問題,也無法在任何地方找到解決方案。我正在使用Python 3.5。 我有這個錯誤給我看時,我運行一個簡單的導入:AttributeError:'Cycler'對象沒有屬性'change_key'

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 

所以最初的東西是不是和他們的循環儀碰撞?

我該如何解決這個問題?有什麼建議麼?謝謝!

回答

9

剛剛檢查了cycler的版本,它已過時。只是

sudo pip3 install --upgrade cycler

sudo -H python3 -m pip install --upgrade cycler更新循環儀。

+0

不要忘記你可以使用'--user'而不是'sudo' – Eric