2014-10-27 56 views
1

我在Ubuntu 14.04上安裝了Enthought Canopy。我試圖運行示例matplotlib程序(從圖書館的網站)。運行程序的每一個試圖讓下面的消息雨棚的命令提示符顯示:在Canopy中導入matplotlib時出錯 - rc_params_from_file()

TypeError         Traceback (most recent call last) 
/home/guras/Canopy/appdata/canopy-1.4.1.1975.rh5-x86_64/lib/python2.7/site-packages/IPython/utils/py3compat.pyc in execfile(fname, *where) 
    202    else: 
    203     filename = fname 
--> 204    __builtin__.execfile(filename, *where) 

/home/guras/Python programy/pierwszy.py in <module>() 
     4 This example uses the Fahrenheit and Celsius scales. 
     5 """ 
----> 6 import matplotlib.pyplot as plt 
     7 import numpy as np 
     8 

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/pyplot.py in <module>() 
    26 import matplotlib 
    27 import matplotlib.colorbar 
---> 28 from matplotlib import style 
    29 from matplotlib import _pylab_helpers, interactive 
    30 from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike 

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/__init__.py in <module>() 
     1 from __future__ import absolute_import 
     2 
----> 3 from .core import use, context, available, library, reload_library 

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in <module>() 
    147 # Load style library 
    148 # ================== 
--> 149 _base_library = load_base_library() 
    150 
    151 library = None 

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in load_base_library() 
    92  """Load style library defined in this package.""" 
    93  library = dict() 
---> 94  library.update(read_style_directory(BASE_LIBRARY_PATH)) 
    95  return library 
    96 

/home/guras/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/style/core.py in read_style_directory(style_dir) 
    125  styles = dict() 
    126  for path, name in iter_style_files(style_dir): 
--> 127   styles[name] = rc_params_from_file(path, use_default_template=False) 
    128  return styles 
    129 

TypeError: **rc_params_from_file() got an unexpected keyword argument 'use_default_template'** 

任何想法如何解決呢?

+0

我想你已經跨越了mpl版本的安裝。 – tacaswell 2014-10-27 22:12:26

回答

1

use_default_template關鍵字參數was added添加到matplotlib版本1.4.0rc1中的rc_params_from_file函數。

很可能,您的matplotlib版本比1.4.0rc1舊,需要升級。


如果您安裝matplotlib的多於一個的安裝,你需要確保包含新版本的目錄早於舊版本列在sys.path,或者,乾脆刪除舊版本matplotlib。

0

使用Canopy Package Manager將matplotlib更新到最新版本。