from captcha.image import ImageCaptcha
image = ImageCaptcha().generate_image("9527")
image.show()

https://www.cnblogs.com/zwhy8/p/13414940.html