對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