python2.7安装etuptools-36.6.0报ascii' codec can't decode byte 0xce in position 7问题

解决办法1:

原文链接:http://blog.csdn.net/all_over_servlet/article/details/45112221

修改编码为gbk,修改D:\Python27\Lib\ntpath.py(位置由个人python安装目录决定)文件中的def join(path, *paths)函数,在函数内第一行加入

reload(sys)
sys.setdefaultencoding(‘gbk‘)  

即:

# Join two (or more) paths.
def join(path, *paths):
    """Join two or more pathname components, inserting "\\" as needed."""
   reload(sys)
   sys.setdefaultencoding(‘gbk‘)  
    result_drive, result_path = splitdrive(path)
    for p in paths:
        p_drive, p_path = splitdrive(p)
        if p_path and p_path[0] in ‘\\/‘:
            # Second path is absolute
            if p_drive or not result_drive:
                result_drive = p_drive
            result_path = p_path
            continue
        elif p_drive and p_drive != result_drive:
            if p_drive.lower() != result_drive.lower():
                # Different drives => ignore the first path entirely
                result_drive = p_drive
                result_path = p_path
                continue
            # Same drive in different case
            result_drive = p_drive
        # Second path is relative to the first
        if result_path and result_path[-1] not in ‘\\/‘:
            result_path = result_path + ‘\\‘
        result_path = result_path + p_path
    ## add separator between UNC and non-absolute path
    if (result_path and result_path[0] not in ‘\\/‘ and
        result_drive and result_drive[-1:] != ‘:‘):
        return result_drive + sep + result_path
    return result_drive + result_path  

解决办法2:(PS:这是网上最多解答的帖子,不一定能够解决,楼主自己是依照解决方法1解决了问题)

注意Python语法缩进原则。

python2.7安装etuptools-36.6.0报ascii' codec can't decode byte 0xce in position 7问题

时间: 2024-10-08 02:40:11

python2.7安装etuptools-36.6.0报ascii' codec can't decode byte 0xce in position 7问题的相关文章

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

python在安装时,默认的编码是ascii,当程序中出现非ascii编码时,python的处理常常会报这样的错UnicodeDecodeError: 'ascii' codec can't decode byte 0x?? in position 1: ordinal not in range(128),python没办法处理非ascii编码的,此时需要自己设置将python的默认编码,一般设置为utf8的编码格式. 查询系统默认编码可以在解释器中输入以下命令:python代码 >>>

Windows下使用pip安装python包是报错-UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 0

先交待下开发环境: 操作系统:Windows 7 Python版本:2.7.9 Pip版本:6.1.1 其他环境忽略 在windows下使用pip下载python包,出现如下错误 [plain] view plain copy Collecting xxxxxx Exception: Traceback (most recent call last): File "D:\Python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\basecommand.

python安装程序是报这样的错UnicodeDecodeError: 'ascii' codec can't decode byte 0xb0 in position 1: ordinal not in range(128)

python在安装时,默认的编码是ascii,当程序中出现非ascii编码时,python的处理常常会报这样的错UnicodeDecodeError: 'ascii' codec can't decode byte 0x?? in position 1: ordinal not in range(128) 有2种方法设置python的默认编码: 方法一: 在程序中加入以下代码: import sys reload(sys) sys.setdefaultencoding('utf8') 方法二:

python2 使用openpyxl 报错UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 20: ordinal not in range(128) 解决方法

# -*- coding: utf-8 -*- #! /usr/bin/env python # author: xiao~~ import openpyxl import sys reload(sys) sys.setdefaultencoding('utf-8') wb2=openpyxl.Workbook() wb2.save('test1.xlsx') print('新建成功') 附上剪短的代码 报错信息 Traceback (most recent call last): File "

Python报错“UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)”的解决办法

最近在用Python处理中文字符串时,报出了如下错误: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)   1.原因 因为默认情况下,Python采用的是ascii编码方式,如下所示: ?? python -c "import sys; print sys.getdefaultencoding()" ascii ?? 而Python在进行编

安装mysql-python报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 65: ordinal not in range(128)

安装mysql-python报错: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 65: ordinal not in range(128) 需要先安装(yum): mysql-develpython-devel 安装mysql-python报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 65: ordinal

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0

Windows 7/8/10机器上安装Python 2.7后,下载一些Package包进行setup时总是报错UnicodeDecodeError,如下: File "C:/Python27/lib/mimetypes.py", line 250, in enum_types ctype = ctype.encode(default_encoding) # omit in 3.x! UnicodeDecodeError: 'ascii' codec can't decode byte

[Python] 运行Flask, 报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 33: ordinal not in range(128)

运行时报错:UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 33: ordinal not in range(128) Python2.7在Windows上一个bug!!! 解决方法: 参考官方patch: http://bugs.python.org/file19332/9291a.patch 如下代码:一,加入from itertools import count: 二,修改 def enum_type

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

kilo版,horizon界面用中文,删除时报错."UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)" 出错原因就是python的str默认是ascii编码,和unicode编码冲突,就会报这个标题错误.那么该怎样解决呢? 解决方法如下: vim /usr/lib/python2.7/site-packages/horizon/tables/