我无法让 matplotlib 显示窗口。
我已经下载了 python 3.3、python 3.3 的 matplotlib 和 numpy。
我还为 Visual Studio 2012 安装了 python 工具,因此我可以在该环境中创建 python 解决方案。
有了这一切......我正在运行这个非常简单的脚本:
import numpy as np
import matplotlib.pyplot as plt
import pylab
# Come up with x and y
x = np.arange(0, 5, 0.1)
y = np.sin(x)
# 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
pylab.show()
这编译没有警告或错误,但只显示我的控制台窗口;没有图形或交互式窗口出现过。我尝试从命令提示符运行脚本,认为可能是 Visual Studio 环境将其丢弃,但它仍然无法正常工作。
我也尝试使用 python 2.7 运行,但它也没有工作。
我发现的每个教程都证实这应该有效。我正在拔头发,并会在这一点上表扬任何帮助。