Skip to main content
 首页 » 编程设计

python之我怎样才能杀死 python matplotlib 脚本

2025年05月04日10yyy_WW

所以我开始尝试在 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 窗 Eloquent 能执行另一个命令。有没有办法正确终止执行,这样我就不必每次都关闭 python shell 来运行另一个脚本?

请您参考如下方法:

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

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