python3.x运行的坑:AttributeError: 'str' object has no attribute 'decode'
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'
报错截图:


python3.x运行的坑:AttributeError: 'str' object has no attribute 'decode'的更多相关文章
- Django项目与mysql交互进行数据迁移时报错:AttributeError: 'str' object has no attribute 'decode'
问题描述 Django项目启动,当我们执行命令 python manage.py makemigrations 出现如下错误: File , in last_executed_query query ...
- Django2.2报错 AttributeError: 'str' object has no attribute 'decode'
准备将 Django 连接到 MySQL,在命令行输入命令 python manage.py makemigrations 后报错: AttributeError: 'str' object has ...
- 解决编码问题:AttributeError: 'str' object has no attribute 'decode'
1. 问题发现: 出现:读取文件,对其进行解码,出现错误,AttributeError: 'str' object has no attribute 'decode' 解释:属性错误,str对象不包含 ...
- AttributeError: 'str' object has no attribute 'decode'
ue = e.decode('latin-1')修改为: ue = e.encode('ascii', 'strict')
- 执行: python manage.py makemigrations报AttributeError: 'str' object has no attribute 'decode'
找到错误代码(line146):query = query.encode(errors='replace') 解决方法:把decode改为encode即可.
- Django 运行报异常:AttributeError: 'str' object has no attribute 'get'
Technorati Tags: Python,Django,Web 在使用django.contrib.auth用户机制进行用户的验证.登录.注销操作时,遇到这个异常. 首先是写了一个登录的视图,要 ...
- Python PyInstaller 打包报错:AttributeError: 'str' object has no attribute 'items'
pyinstaller打包时报错:AttributeError: 'str' object has no attribute 'items' 网上查询,可能是setuptools比较老: 更新一下 p ...
- 【Python-遇到的Error】AttributeError: 'str' object has no attribute 'input_text'
学习类的实例化的时候遇到了AttributeError: 'str' object has no attribute 'input_text', 以下是报错的代码及修改正确的代码. class shu ...
- python2 'str' object has no attribute 'decode'
'.decode('hex') 上述代码,报错: 'str' object has no attribute 'decode' 查找原因: https://stackoverflow.com/ques ...
随机推荐
- PHP获取时间排除周六、周日的两个方法
//方法一: <?php $now = time(); //指定日期用法 $now = strtotime('2014-01-08') ; $day = 3600*24; $total = 12 ...
- 关闭本机的代理服务(Proxy)
若您使用了代理服务(Proxy),可能会导致战网游戏发生网络连接.安装或更新方面的问题.请参考以下步骤来关闭您电脑的网络代理服务. Windows 按下 Windows 按鍵 + R . 在运行框中, ...
- 170820-关于JSP页面的知识点
1.JSP [1] 简介 > HTML - HTML擅长显示一个静态的网页,但是不能调用Java程序. > Servlet - Servlet擅长调用Java程序和后台进行交互,但是它不擅 ...
- FCC 成都社区·前端周刊 第 10 期
1. Node.js 10 正式发布 在过去的一周,Node.js 10.0.0 正式发布,带来大量改进和修复.这是自 Node.js Foundation 开展以来的第七个主要版本,并将在 2018 ...
- MySql常用语句总结更新
1.Mysql修改字段的默认值: alter table tablename alter column drop default; (若本身存在默认值,则先删除) alter table tablen ...
- 获取系统的documents路径
获取路径 https://superuser.com/questions/1132288/windows-command-prompt-get-relocated-users-documents-fo ...
- 生产环境下,oracle不同用户间的数据迁移。第三部分
任务名称:生产环境下schema ELON数据迁移至schema TIAN########################################前期准备:1:确认ELON用户下的对象状态se ...
- 1204C Anna, Svyatoslav and Maps
题目大意 给你一个有向图和一个路径 让你在给定路径中选出尽量少的点使得新路径的最短路长度和原路径相等 给定路径相邻两点间距离为1 分析 先floyd求出两点间最短路 之后每次对于点i找到所有跟它的最短 ...
- django初学---基本目录结构-配置html页面显示步骤
extra_apps 存放第三方应用,包,源码 apps -- 存放内部应用 static --存放CSS文件,JS文件,图片文件等待 media -- 存放系统里允许用户上传的图片或者文件 requ ...
- 【ABAP系列】SAP ABAP模块-任意report作为附件以邮件形式发送
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP模块-任意rep ...