当我从anaconda提示符运行此脚本时会发生这种情况
import time
import matplotlib.pyplot as plt
plt.ion()
plt.plot([1,4,2])
plt.draw()
plt.pause(0.01)
time.sleep(0.1)
h = 0
for n in range(0,9500):
h += 1
print(h)
time.sleep(2)
但是如果我在命令窗口中逐行运行此代码
>>>import matplotlib.pyplot as plt
>>>plt.ion()
>>>plt.plot([1,4,2])
>>>#window is responding and I can do anything I want here
为什么会这样?我希望能够在计算时看到情节。