对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

版权声明:本文为zzmx0原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/zzmx0/p/13495839.html