python3.x运行的坑:AttributeError: 'str' object has no attribute 'decode'

别来无恙 提交于 2019-11-29 01:53:52

python3.x运行的坑:AttributeError: 'str' object has no attribute 'decode'

2019.05.22 21:38:45字数124阅读1909

1、Python3.x和Python2.X版本有一些区别,我遇到了两个问题如下:

 

a.第一个报:mysqlclient 1.3版本不对:

解决办法:注释掉这行即可;

b.第二个报:字符集的问题:

报错如下:File "C:\Users\Administrator\PycharmProjects\untitled1\venv\lib\site-packages\django\db\backends\mysql\operations.py", line 146, in last_executed_query

    query = query.decode(errors='replace')

AttributeError: 'str' object has no attribute 'decode'

报错截图:

 

 
解决办法:注释掉这里,因为字符集不支持的原因

 

 
 
 
0人点赞
 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!