python - 在 Canopy 中导入 matplotlib 时出错 - rc_params_from_file()

标签 python ubuntu matplotlib canopy

我在 Ubuntu 14.04 上安装了 Enthought Canopy。我正在尝试运行示例 matplotlib 程序(来自图书馆的网站)。每次尝试运行该程序都会使 Canopy 的命令提示符显示以下消息:

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'** 

有什么解决办法吗?

最佳答案

use_default_template 关键字参数 was added到 matplotlib 版本 1.4.0rc1 中的 rc_params_from_file 函数。

很可能,您的 matplotlib 版本早于 1.4.0rc1,需要升级。

<小时/>

如果您安装了多个 matplotlib,则需要确保包含较新版本的目录早于 sys.path 中的旧版本列出,或者可能只是简单地列出删除旧版本的 matplotlib。

关于python - 在 Canopy 中导入 matplotlib 时出错 - rc_params_from_file(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26597582/

相关文章:

python - 显示形状文件

python - imshow 当您绘制数据而不是图像时。 aspect 和 extent 之间的关系?

python - 检查两个 csv 文件的两列值,如果找到匹配,则写入另一个 csv 文件

python - 所有 os.popen() 方法之间有什么区别?

python - 通过 httpd 上的 Flask-PyMongo 连接到 MongoHQ URI 时出现 ConnectionFailure

mysql - 在 Ubuntu 14.04 上安装 mysqldump

ubuntu - 无法连接到在 VirtualBox 内的 Xubuntu 上运行的 Jupyter 笔记本服务器

python - 从源代码安装和使用 OpenCV

python - Pandas DataFrame 切片与副本 : which one is more memory friendly?

python - 将多组子图拟合到一个图中