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