pillow模块 用于操作图片的模块 安装 pip install pillow 生成验证码 from PIL import Image,ImageDraw,ImageFont from io import BytesIO,StringIO import random def get_random(): return random.randint(0,255),random.randint(0,255),random.randint(0,255) def get_code(request): #…