第一种代码(失败代码)
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
font_path = '/Users/huangbaixi/Desktop/SimHei.ttf'
def plot_demo():
#print(mpl.get_cachedir())
# 绘制折线图
font_prop = FontProperties(fname=font_path)
plt.rcParams['font.sans-serif'] = [font_prop.get_name()]
plt.rcParams['axes.unicode_minus'] = False
year = [2017, 2018, 2019, 2020]
people = [20, 40, 60, 70]
# 生成图表
plt.plot