如何检查 whether/which matplotlibrc 是否被使用

How to check whether/which matplotlibrc was used

我在 anaconda 环境中使用 python。当我导入 matplotlib 时,我遇到了与 xwpython 的兼容性问题。所以,我想切换后端。通常,这将通过 matplotlibrc 文件来完成。但是,似乎忽略了 ~/.config/matplotlib/ 下的 matplotlibrc。是否可以检查在导入 matplotlib 期间是否使用了 matplotlibrc 文件以及使用了哪个文件?使用 python 2.7.

您可以使用以下方式获取文件路径:

import matplotlib
print(matplotlib.matplotlib_fname())

我的情况 returns:

'/Users/m300241/.matplotlib/matplotlibrc'