简体   繁体   English

matplotlib 找不到配置文件 matplotlibrc

[英]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.

相关问题 matplotlib 在 IPython 中不使用 matplotlibrc 文件 - matplotlib not using matplotlibrc file in IPython 是否有一个sympy默认文件,例如matplotlib具有〜/ matplotlib / .matplotlibrc? - Is there a sympy defaults file, like matplotlib has ~/matplotlib/.matplotlibrc? 从matplotlibrc文件加载matplotlib rcparams时,Jupyter Notebook内联绘图中断 - Jupyter notebook inline plotting breaks, when loading matplotlib rcparams from matplotlibrc file Pyinstaller Matplotlib [Errno 2] 没有这样的文件或目录:'C:\\Users\\Tobi\\AppData\\Local\\Temp\\_MEI142562\\matplotlib\\mpl-data\\matplotlibrc' - Pyinstaller Matplotlib [Errno 2] No such file or directory: 'C:\\Users\\Tobi\\AppData\\Local\\Temp\\_MEI142562\\matplotlib\\mpl-data\\matplotlibrc' 无法找到 matplotlib 配置文件的正确文档.mplstyle - Impossible to find proper documentation for matplotlib configuration file .mplstyle Matplotlib:有没有办法用 matplotlibrc 设置默认散布 styles? - Matplotlib: Is there a way to set default scatter styles with matplotlibrc? Matplotlib 找不到 fonts - Matplotlib cannot find fonts 在 matplotlib 中使用 ffmpeg 制作动画时“系统找不到指定的文件” - "The system cannot find the file specified" when animating with ffmpeg in matplotlib matplotlib.animation错误-系统找不到指定的文件 - matplotlib.animation error - The system cannot find the file specified 是否可以将 bbox_to_anchor 放入 matplotlibrc 文件中? - Is it possible to put bbox_to_anchor into a matplotlibrc file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM