【发布时间】:2021-01-08 03:53:42
【问题描述】:
我正在运行一个 python 程序,使用以下代码将文件夹中的所有 .png 文件转换为 gif:
import glob
from PIL import Image
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
# filepaths
fp_in = path_monthly + '/' + "*.png"
fp_out = path_directory + '/' + "Monthly_MB.gif"
# https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#gif
img, *imgs = [Image.open(f) for f in sorted(glob.glob(fp_in))]
img.save(fp=fp_out, format='GIF', append_images=imgs,
save_all=True, duration=600, loop=0)
import glob
from PIL import Image
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
# filepaths
fp_in = path_yearly + '/' + "*.png"
fp_out = path_directory + '/' + "Yearly_MB.gif"
# https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#gif
img, *imgs = [Image.open(f) for f in sorted(glob.glob(fp_in))]
img.save(fp=fp_out, format='GIF', append_images=imgs,
save_all=True, duration=600, loop=0)
共有 193 个 png 文件,总大小为 500Mb。我的笔记本电脑有 16Gb 的 RAM。但是,当我运行程序时,内核被自动杀死并重新启动并显示:
正在重启内核...
[SpyderKernelApp] 警告 |没有这样的通讯:25562a62516411ebbc72f17b9468ff8d
为什么这个程序似乎使用了我笔记本电脑的所有 RAM?我在双启动上运行,有足够的存储空间,除了 spyder 之外没有其他主要程序在后台运行。你知道为什么会出现这种问题吗?
非常感谢!
【问题讨论】:
-
您使用的是 64 位操作系统还是 32 位操作系统?
-
我使用的是 64 位操作系统。我还在一个服务器上运行它,当没有人使用它时,它设法让它运行
标签: python linux-kernel ram comm