python - matplotlib 找不到配置文件 matplotlibrc

标签 python python-3.x matplotlib configuration

我在 Ubuntu 14.04 上使用 matplotlib 1.3.1 和 python 3.4.0。我想使用 matplotlibrc configuration file在 .config/matplotlib/matplotlibrc 中。然而 matplotlib 似乎无法找到它:

~$ ls ~/.config/matplotlib/
matplotlibrc
~$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
/usr/lib/python3/dist-packages/matplotlib/__init__.py:766: UserWarning: Could not find matplotlibrc; using defaults
  warnings.warn('Could not find matplotlibrc; using defaults')
/usr/lib/python3/dist-packages/matplotlib/__init__.py:882: UserWarning: could not find rc file; returning defaults
  warnings.warn(message)

我的 matplotlibrc 的内容是 here 中的默认内容.

如何让 matplotlib 找到配置文件?

编辑:

>>> matplotlib.get_configdir()
'/home/<me>/.matplotlib'

最佳答案

matplotlib.get_configdir()的文档字符串中,我发现如果.matplotlib/存在,matplotlib将不会在~/.config中查找.

因此,即使 ~/.config/matplotlib/matplotlibrc 存在,您也应该完全删除 ~/.matplotlib 目录。

请注意,我还必须 delete matplotlib's fontcache之后。

关于python - matplotlib 找不到配置文件 matplotlibrc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29073802/

相关文章:

python - TkInter create_rectangle() 固定大小

python - 在Python中同时对URL发出多个POST请求

带有嵌套列表的 Python 字典键到 pandas DataFrame

python - list.index() 是否实现缓存

python - hist2d 中的 vmin 和 vmax

python - 如何规范化包含大量不同集合的深层嵌套 JSON 结果?

python - 如何一次写入多个 csv 行?

python - Matplotlib.pyplot : force exponential axis label notation

python - Django 模型对象有长度函数吗?

python - 导入为 16 位深但意外的 plt.show() 结果的 DNG 原始图片