在python的matplotlib包中运行一个简单的画图demo
import matplotlib.pyplot as plt
xlist = [1,2,3,4]
ylist = [5,6,7,8]
plt.plot(xlist, ylist)
plt.xlabel("x参数")
plt.xlabel("y参数")
plt.show()
运行之后,报错:ValueError: matplotlib display text must have all code points < 128 or use Unicode strings
解决方案很简单
plt.xlabel(u"x参数")
plt.xlabel(u"y参数")
将中文见面加上u,更改字符编码即可