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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM