安装DBUtils报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in ra

原创 2016年08月30日 16:04:03

今天在win7上安装DBUtils的时候总是报出如下错误

D:\software\develop_software_installed\DBUtils-1.1\DBUtils-1.1>python setup.py i
nstall
Traceback (most recent call last):
  File "setup.py", line 17, in <module>
    from setuptools import setup
  File "D:\software\develop_software_installed\python27\lib\site-packages\setupt
ools-18.1-py2.7.egg\setuptools\__init__.py", line 11, in <module>
  File "D:\software\develop_software_installed\python27\lib\site-packages\setupt
ools-18.1-py2.7.egg\setuptools\extension.py", line 8, in <module>
  File "D:\software\develop_software_installed\python27\lib\site-packages\setupt
ools-18.1-py2.7.egg\setuptools\dist.py", line 16, in <module>
  File "D:\software\develop_software_installed\python27\lib\site-packages\setupt
ools-18.1-py2.7.egg\setuptools\depends.py", line 6, in <module>
  File "D:\software\develop_software_installed\python27\lib\site-packages\setupt
ools-18.1-py2.7.egg\setuptools\compat.py", line 19, in <module>
  File "D:\software\develop_software_installed\python27\lib\SimpleHTTPServer.py"
, line 27, in <module>
    class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  File "D:\software\develop_software_installed\python27\lib\SimpleHTTPServer.py"
, line 208, in SimpleHTTPRequestHandler
    mimetypes.init() # try to read system mime.types
  File "D:\software\develop_software_installed\python27\lib\mimetypes.py", line
358, in init
    db.read_windows_registry()
  File "D:\software\develop_software_installed\python27\lib\mimetypes.py", line
258, in read_windows_registry
    for subkeyname in enum_types(hkcr):
  File "D:\software\develop_software_installed\python27\lib\mimetypes.py", line
249, in enum_types
    ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal
not in range(128)


解决方法:

在DBUtils下的setup.py文件添加如下三行代码

import sys
reload(sys) 
sys.setdefaultencoding('gb18030')

重新运行python setup.py install就能成功安装DBUtils了。



相关文章推荐

Win7安装Web.py,UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in

突然想看看Webpy, 在网上看到一个篇:在windows下如何快速搭建web.py开发框架

解决Django编码报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1······

之前在用Apache+mod_wsgi.so搭建Windows下Django服务器时,Apache报错,错误日志中写到: [:warn] [pid 7112:tid 200] mod_wsgi: C...

【Python】【解决】UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 1: ordinal not in r

转载自:http://www.cnblogs.com/QuLory/p/3615584.html 1、问题描述 今天在升级Ubuntu到14.04,使用命令行启动软件更新器,进行版...

解决“UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 3: ordinal not in range(128”

解决“UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xd7 in position 3: ordinal not in range(128)...

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 0: ordinal not in range(128)

python3安装xadmin出现 UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 3444

python3的环境安装xadmin时,直接pip install xadmin出现Downloading xadmin-0.6.1.tar.gz (1.0MB) 100% |████████...

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-4: ordinal not in range(128)

#coding:utf-8 print raw_input(u'请输入数字:') 保存为文件while.py,并执行 执行结果如下图所示: 解决办法: 在你python的安装目录下的L...
  • zm2714
  • zm2714
  • 2012年10月15日 12:02
  • 6918

pip 安装pandas报UnicodeDecodeError: 'ascii' codec can't decode byte 0xd5错

当python在window环境中通过pip安装pandas报标题这样的错,主要是因为python默认编码格式是:ascii 在https://www.python.org/dev/peps/pep-...

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 3: invalid continuation byte

Exception: Traceback (most recent call last): File "********\python36\lib\site-packages\pip\compat...

python爬虫解析json数据报错(unicode error) 'utf-8' codec can't decode byte 0xbb in position 0

先解释一些 概念 序列化(Serialization):将对象的状态信息转换为可以存储或可以通过网络传输的过程,传输的格式可以是JSON、XML等。反序列化就是从存储区域(JSON,XML)读取反...
  • shulixu
  • shulixu
  • 2016年09月25日 16:32
  • 2711
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:安装DBUtils报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in ra
举报原因:
原因补充:

(最多只允许输入30个字)