import matplotlib.font_manager as fm
import matplotlib.pyplot as plt
font_path = [path] # font location
newfont = font_manager.findSystemFonts(font_Path) # find fonts
fm.fontManager.addfont(newfont) # add fonts
# then use the newfonts:
plt.rcParams['font.family'] = "newfont"
# Or In the latest matplotlib version > 3.2
font_path = 'Inter-Regular.otf' # Your font path goes here
fm.fontManager.addfont(font_path)
prop = fm.FontProperties(fname=font_path)
#Use fonts
plt.rcParams['font.family'] = 'sans-serif'
plt.rcParams['font.sans-serif'] = prop.get_name()