[英]matplotlib cannot find configuration file matplotlibrc
I am using matplotlib 1.3.1 with python 3.4.0 on Ubuntu 14.04.我在 Ubuntu 14.04 上使用 matplotlib 1.3.1 和 python 3.4.0。 I would like to use a matplotlibrc configuration file in
.config/matplotlib/matplotlibrc
.我想在
.config/matplotlib/matplotlibrc
使用matplotlibrc 配置文件。 However it seems like matplotlib is unable to find it:但是似乎 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)
The content of my matplotlibrc
is the default one from here .我的
matplotlibrc
的内容是这里的默认内容。
How can I make matplotlib find the configuration file?如何让 matplotlib 找到配置文件?
EDIT:编辑:
>>> matplotlib.get_configdir()
'/home/<me>/.matplotlib'
From the docstring of matplotlib.get_configdir()
I discovered that matplotlib will not look in ~/.config
if .matplotlib/
exists.从
matplotlib.get_configdir()
的文档字符串中,我发现如果.matplotlib/
存在,则 matplotlib 不会在~/.config
.matplotlib/
。
So even though ~/.config/matplotlib/matplotlibrc
exists, you should delete the ~/.matplotlib
directory entirely.所以即使
~/.config/matplotlib/matplotlibrc
存在,你也应该完全删除~/.matplotlib
目录。
Note that I also had to delete matplotlib's fontcache afterwards.请注意,之后我还必须删除 matplotlib 的 fontcache 。
I found mine here without having to delete the .matplotlib dir我在这里找到了我的,而不必删除 .matplotlib 目录
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/mpl-data/matplotlibrc /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/matplotlib/mpl-data/matplotlibrc
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.