在SublimeText 3中不显示Matplotlib图。

问题描述 投票:0回答:1

这个问题与之前提出的问题类似(Matplotlib图在sublimetext中不显示。),但给出的解决方案是针对SublimeText2的,而对我来说,SublimeText3是行不通的。

我的问题基本上是一样的。使用示例代码

import matplotlib.pyplot as plt

x = [1,2,3,4]
y = x

plt.plot(x,y)
plt.show()

会给我一个在IDE中显示或在终端运行时显示的情节,但我不能让它在SublimeText中显示。除非我手动取消构建,否则代码会继续运行,但如果我在使用IDE或在终端中运行,代码就会正常运行。plt.show() 是注释出来的(当然剧情不显示)。

我是否必须使用除崇高文本以外的其他东西来实现这个目标。在Windows 10上运行也是如此。

谢谢。

EDIT

尝试运行时发生的截图。

When trying to run the code, the plt.plot() runs fine but it will just continue to run after the print statement until I force it to cancel, with no graph shown

When plt.show() is removed, the code will run successfully but again no graph shown.

当尝试运行代码时,plt.plot()运行得很好 但它会在print语句后继续运行,直到我强制取消,没有图形显示出来

当删除plt.show()后,代码将成功运行,但同样没有图形显示。

使用 plt.savefig() 会保存图形,没有问题。

python matplotlib sublimetext3
1个回答
0
投票

我的工作正常。是否有错误信息?我建议安装最新版本的sublime,我想。

另外,你的环境变量中是否设置了python?我也建议这样做

然后之后就是去工具->构建系统->(检查)Python。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.