问题在于你正在从对hist()的调用中设置plt,这不是你想要的。通常将matplotlib导入为plt,假设这是这里想要的内容:import matplotlib.pyplot as plt data = [1, 2, 3, 4] p = plt.hist(data) plt.xticks(rotation='vertical') plt.show()