我运行了你的代码,改了一点。它直到plt.show()才显示,你跑那条线了吗?
import numpy as np
import matplotlib.pyplot as plt
plt.close("all")
plt.figure()
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)
plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)
plt.show()