Windows下pip安装及更新出现“UnicodeEncodeError: 'ascii' codec can't encode character u'\u258c' in position 8: ordinal not in range(128)”问题解决办法

 

问题显示如下:

1.找到Python安装包的路径Lib\site-packages(如:E:\python27\Lib\site-packages)

2.在该路径下创建sitecustomize.py,文件中的内容如下:

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

3.再次进行pip安装和更新时,问题解决如下所示:

Windows下pip安装及更新出现“UnicodeEncodeError: 'ascii' codec can't encode character u'\u258c' in position 8: ordinal not in range(128)”问题解决办法的更多相关文章

  1. UnicodeEncodeError: 'ascii' codec can't encode character u'\u5929' in position 2: ordinal not in range(128)

    UnicodeEncodeError: 'ascii' codec can't encode character u'\u5929' in position 2: ordinal not in ran ...

  2. UnicodeEncodeError: 'ascii' codec can't encode character u'\u65e0' in position 1: ordinal not in range(128)

    UnicodeEncodeError: 'ascii' codec can't encode character u'\u65e0' in position 1: ordinal not in ran ...

  3. ERROR (UnicodeEncodeError): 'ascii' codec can't encode character u'\uff08' in position 9: ordinal not in range(128)

    环境win10+anaconda2 在安装labelme时遇到了这个问题,其实跟labelme没啥关系,主要是python2读取中文路径时报错,因为默认编码是ASCII,不认识中文,看到有一个一次性解 ...

  4. 【Python】解决UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 0: ordinal not in range(128)

    指定文件字符集为utf-8 在文件头部加入以下代码: import sys reload(sys) sys.setdefaultencoding('utf-8')

  5. UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 7: ordinal not in range(128) [duplicate]

    Python在往文件里写东西的时候,如果ascii码报错 参考 http://stackoverflow.com/questions/19833440/unicodeencodeerror-ascii ...

  6. UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\u8888′ in position 0: ordinal not in range(168)

    python保存文件UnicodeEncodeError以及reload(sys)后print失效问题 在将字符串写入文件时,执行f.write(str),后台总是报错:UnicodeEncodeEr ...

  7. 数据库连接 UnicodeEncodeError: 'latin-1' codec can't encode character u'\u4eac' in position 0: ordinal not in range(256),UnicodeEncodeError: 'latin-1' codec can't encode character

    处理方法就是,设置连接和游标的charset为你所希望的编码,如utf8, 连接数据库的时候加上   charset="utf8 db = MySQLdb.connect(host= '14 ...

  8. UnicodeEncodeError: 'ascii' codec can't encode character u'\u5728' in position 1

    s = "图片picture"print chardet.detect(s) for c in s.decode('utf-8'): print c UnicodeEncodeEr ...

  9. 解决:"UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position"错误

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/Haiyang_Duan/article/ ...

随机推荐

  1. Good Bye 2018 (A~F, H)

    目录 Codeforces 1091 A.New Year and the Christmas Ornament B.New Year and the Treasure Geolocation C.N ...

  2. SSM整合Activiti

    1.pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="h ...

  3. IDEA中的常用设置

    ps:对于开发工具,不同的开发人员有不同的设置喜好,这里介绍的是我个人的配置,不喜勿喷. Appearance:个人喜欢全黑主题,雅黑字体 背景图片, 效果如下,编写代码的时候有个自己喜欢的背景图片, ...

  4. [CC-SEAPERM2]Sereja and Permutations

    [CC-SEAPERM2]Sereja and Permutations 题目大意: 有一个\(n(n\le300)\)排列\(p\),将其中一个元素\(p_i\)拿掉,然后将原来大于\(p_i\)的 ...

  5. 轻松理解Redux原理及工作流程

    轻松理解Redux原理及工作流程 Redux由Dan Abramov在2015年创建的科技术语.是受2014年Facebook的Flux架构以及函数式编程语言Elm启发.很快,Redux因其简单易学体 ...

  6. BZOJ1482 : [Balkan2017]Cats

    若猫和狗中至少有一个出现了$0$次,那么答案显然是$0$,否则若狮子出现了$0$次,那么显然无解. 那么现在至少有一个动物保持原地不同,其它动物恰好移动一次. 如果全部猫都不动而全部狗都动,那么可以贪 ...

  7. Java 构造器 通过私有构造器强化不可实例化的能力

    只有当类不包含显式的构造器时,编译器才会生成一个公有的.无参的缺省构造器.只要让一个类包含私有构造器,这个类就不能被实例化了.示例: // 工具类 public class UtilityClass ...

  8. python添加、修改、删除、访问类对象属性的2种方法

    1.直接添加.修改.删除.访问类对象属性 class Employee (object): empCount = 0 def __init__(self, name, salary) : self.n ...

  9. db2 reorg runstats rebind具体操作

    db2 reorg runstats rebind具体操作 #reorg table db2 -x "select 'reorg table '||rtrim(tabschema)||'.' ...

  10. css 文本超出n行就隐藏并且显示省略号

    首先,要知道css的三条属性. overflow:hidden; //超出的文本隐藏 text-overflow:ellipsis; //溢出用省略号显示 white-space:nowrap; // ...