# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pillow from PIL import Image, ImageFont, ImageDraw # 微软雅黑的字体 path_to_ttf = r'c:windowsfontsmsyh.ttc' font = ImageFont.truetype(path_to_ttf, size=100) # 打开指定文件 img=Image.open(r"D:少儿编程PythonShowImageinDebug学生蔡昊.jpg") # 写文字 draw = ImageDraw.Draw(img) draw.text(xy=(100, 300), text='Hello,南墙已破!', font=font,fill=(255,0,0,255)) # 输出 img.show()