码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2017-11-01 22:12:51      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:str   target   too   details   lib   ntp   set   class   文件   

解决办法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问题

标签:str   target   too   details   lib   ntp   set   class   文件   

原文地址:http://www.cnblogs.com/liuzhen1995/p/7768747.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!