LookupError: unknown encoding: cp65001

简介:

python环境下出现了这样的一个问题:

LookupError: unknown encoding: cp65001

设置半天发现不生效,重装python之后,还是不正确。

参考:http://stackoverflow.com/questions/10321611/python-emit-some-utf-8-string-to-windows-console

网上有人遇到过此类问题,给出的解决办法如下(http://apoo.bokee.com/7028948.html ):

解决方案一、最简单解决重定向异常的方法是:

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

但是其实,import sys 都不认识,后面的就无从谈起,windows的cmd.exe做的真是烂。



本文转自 念槐聚 博客园博客,原文链接:http://www.cnblogs.com/haochuang/p/3981806.html,如需转载请自行联系原作者

相关文章
|
8月前
|
XML 编解码 数据格式
python报错 ‘utf-8‘ codec can‘t encode characters in position xxxx-xxxx: surrogates not allowed
python报错 ‘utf-8‘ codec can‘t encode characters in position xxxx-xxxx: surrogates not allowed
239 0
|
Java 关系型数据库 MySQL
tomcat运行报错:unknown character set utf8mb4
tomcat运行报错:unknown character set utf8mb4
87 0
|
Python
SyntaxError: Non-UTF-8 code starting with ‘\xc7‘ in file
学习SyntaxError: Non-UTF-8 code starting with ‘\xc7‘ in file。
356 0
成功解决 SyntaxError: Non-UTF-8 code starting with \xc0 in file but no encoding declared; see http://p
成功解决 SyntaxError: Non-UTF-8 code starting with \xc0 in file but no encoding declared; see http://p
成功解决 SyntaxError: Non-UTF-8 code starting with \xc0 in file but no encoding declared; see http://p
|
Python
SyntaxError: Non-ASCII character ‘\xe6‘ in file E:/pythondemo/example2.py on line 2, but no encoding
SyntaxError: Non-ASCII character ‘\xe6‘ in file E:/pythondemo/example2.py on line 2, but no encoding
256 0
|
XML 数据格式
因为CircleImageView导致Binary XML file line #96: Error inflating class <unknown>
因为CircleImageView导致Binary XML file line #96: Error inflating class <unknown>
165 0
Not using the local TSLint version found for XXX
今天我打开Visual Studio Code准备进行Angular开发时,看到Angular TSLint报了这个警告信息:
Not using the local TSLint version found for XXX
|
Linux Shell
【Centos】-bash: warning: setlocale: LC_CTYPE: cannot change locale (“zh_CN.UTF-8”): No such file o...
背景: 版本为 centos 6.7,Linux中文显示 原因 echo '$LANG="zh_CN.UTF-8"' >/etc/sysconfig/i18n 解决方案: [root@oldboy ~]# locale -a |grep zh zh_CN zh_CN.
4255 0
|
关系型数据库 数据库 PostgreSQL