python3使用captcha(图片验证码)
对captcha包下的captcha.py文件做修改如下:
一、提示错误:
ModuleNotFoundError: No module named \'cStringIO\'
解决办法:
第9行,将’cStringIO’改为’io
二、提示错误:
AttributeError: module \'string\' has no attribute \'uppercase\' AttributeError: module \'string\' has no attribute \'lowercase\'
解决方法:
71行和208行,将‘uppercase’改为‘ascii_uppercase’,将\’lowercase’改为\’ascii_lowercase’
三、提示错误:
TypeError: string argument expected, got \'bytes\'
解决方法:
第9行,首先从’io’模块中导入’BytesIO’
然后在代码210行左右,\’StringIO\’改为\’BytesIO\’
四、所有xrange都改为range
五、PIL模块需要安装Pillow:
pip install Pillow