首页 > 其他 > 详细

使用ez_setup.py安装setuptools报错

时间:2014-02-23 03:32:43      阅读:378      评论:0      收藏:0      [点我收藏+]

搭建robotframework自动化框架环境时,使用ez_setup.py安装setuptools报错如下

C:\Python27>python ez_setup.py
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz
Extracting in c:\users\907379\appdata\local\temp\tmpvmiaeq
Now working in c:\users\907379\appdata\local\temp\tmpvmiaeq\setuptools-1.4.2
Installing Setuptools
Traceback (most recent call last):
  File "setup.py", line 17, in <module>
    exec(init_file.read(), command_ns)
  File "<string>", line 8, in <module>
  File "c:\users\907379\appdata\local\temp\tmpvmiaeq\setuptools-1.4.2\setuptools\__init__.py", line 11, in <module>
    from setuptools.extension import Extension
  File "c:\users\907379\appdata\local\temp\tmpvmiaeq\setuptools-1.4.2\setuptools\extension.py", line 5, in <module>
    from setuptools.dist import _get_unpatched
  File "c:\users\907379\appdata\local\temp\tmpvmiaeq\setuptools-1.4.2\setuptools\dist.py", line 15, in <module>
    from setuptools.compat import numeric_types, basestring
  File "c:\users\907379\appdata\local\temp\tmpvmiaeq\setuptools-1.4.2\setuptools\compat.py", line 19, in <module>
    from SimpleHTTPServer import SimpleHTTPRequestHandler
  File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
    class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
  File "C:\Python27\lib\SimpleHTTPServer.py", line 208, in SimpleHTTPRequestHandler
    mimetypes.init() # try to read system mime.types
  File "C:\Python27\lib\mimetypes.py", line 358, in init
    db.read_windows_registry()
  File "C:\Python27\lib\mimetypes.py", line 258, in read_windows_registry
    for subkeyname in enum_types(hkcr):
  File "C:\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 0x97 in position 0: ordinal not in range(128)
Something went wrong during the installation.
See the error message above.

解决方法如下:

通过分析最后的错误提示,是由于setuptools包中的setup.py编码格式错误,导致无法安装,以上虽然报错,但是setuptools-1.4.2.tar.gz已经下载完成。那么就可以通过手工安装setuptools包:

1、解压setuptools-1.4.2.tar.gz至C:\Python27\Lib\site-packages\setuptools-1.4.2n27\Lib\site-packages\setuptools-1.4.2

2、修改setup.py,在代码中添加如下几句即可: 

import sys
reload(sys)
sys.setdefaultencoding(‘utf8‘)也可能是’gbk’

3、在cmd窗口中进入Python27\Lib\site-packages\setuptools-1.4.2目录,然后输入:python setup.py install,即可安装成功

使用ez_setup.py安装setuptools报错

原文:http://blog.csdn.net/window_10/article/details/19686007

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!