我怎样才能杀死一个python matplotlib脚本



所以我开始在Linux中使用python进行图像处理。 所以我运行代码

from PIL import Image
from pylab import *
im = array(Image.open('sample.jpg').convert('L'))
im2 = 255 - im
imshow(im)
figure()
imshow(im2)
figure()
im3 = (100.0/255)*im + 100
imshow(im3)
figure()
im4 = 255.0 * (im/255.0)**2
imshow(im4)
show()

我创建了 4 个数字。 当我关闭这些数字并想要运行另一个代码时,我收到消息:

Already Executing:
The Python Shell window is already
executing a command; please wait unit it is finished.

我必须关闭python shell窗口才能执行另一个命令。 无论如何,有没有正确终止执行,这样我就不必每次都关闭 Python shell 来运行另一个脚本?

如果在脚本末尾添加exit()(在调用show之后),您是否会遇到同样的问题?

在Unix上编辑,您应该能够使用ctrl + c中断程序/脚本的执行

你使用的是哪个 Python shell?这种行为似乎很不寻常。如果您使用 ipython ,您可以尝试使用 -pylab -option 运行 ipython 以避免线程问题。

如果您不使用 ipython,请告诉我们您使用的是哪种变体。python?一些IDE,比如Spyder?这真的取决于。

老实说,我建议使用ipython。

相关内容

最新更新