问题
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
Bad key "text.kerning_factor" on line 4 in /home/samyak/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/_classic_test_patch.mplstyle. You probably need to get an updated matplotlibrc file from https://github.com/matplotlib/matplotlib/blob/v3.1.3/matplotlibrc.template or from the matplotlib source distribution
回答1:
It seems to be the case that one of style config files is for matplotlib 3.1 despite that 3.2 is installed.
Go to
/home/samyak/anaconda3/lib/python3.7/site-packages/matplotlib/mpl-data/stylelib/
open
_classic_test_patch.mplstyle
and comment out the line oftext.kerning_factor:6
It worked for me.
回答2:
I encountered the same issue today (using version 3.2.1).
My solution: Reinstall matplotlib :)
回答3:
I had the same problem and I solved it by upgrading Matplotlib using the code:
conda upgrade matplotlib
or
pip install --upgrade matplotlib
回答4:
I also encountered the same problem. Reinstalling matplotlib didn't work for me. I downgraded matplotlib to version 2 using:
conda install matplotlib=2
It worked. Hope this helps.
来源:https://stackoverflow.com/questions/61171307/jupyter-notebook-shows-error-message-for-matplotlib-bad-key-text-kerning-factor