Python 没有正确地显示情节
我这里有一个测试图,我想用pycharm显示Python 没有正确地显示情节,python,pycharm,Python,Pycharm,我这里有一个测试图,我想用pycharm显示 import numpy as np import matplotlib.pyplot as plt # Come up with x and y x = np.arange(0, 5, 0.1) y = np.sin(x) # Just print x and y for fun print(x) print(y) # Plot the x and y and you are supposed to see a sine curve plt.
import numpy as np
import matplotlib.pyplot as plt
# Come up with x and y
x = np.arange(0, 5, 0.1)
y = np.sin(x)
# Just print x and y for fun
print(x)
print(y)
# Plot the x and y and you are supposed to see a sine curve
plt.plot(x, y)
# Without the line below, the figure won't show
plt.interactive(False)
plt.show()
为了便于阅读,我添加了一些注释
但是,当我运行脚本时,pycharm中的SciView
窗口中没有显示任何内容。为什么会这样?我查看了其他资源,设置了plt.interactive(False)
可能会有帮助,但我尝试了这两个选项,但运气都不好,有人能帮忙吗
目前存在类似问题。您可以添加您使用的Pycharm版本吗?您是在控制台中手动执行代码还是运行脚本?
matplotlib.get\u backend()
返回什么?