首先需要安装 PIL 库然后 from PIL import Imageim = Image.open(pash)im.thumbnail((new_width, new_hight))im.save(path)