zoukankan      html  css  js  c++  java
  • Windows 10 执行pip list报错 UnicodeDecodeError: 'gbk' codec can't decode

    在命令行执行任何pip命令都报错:

    C:Usershyang0>pip --version
    Traceback (most recent call last):
      File "c:python3lib
    unpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "c:python3lib
    unpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:python3Scriptspip.exe\__main__.py", line 9, in <module>
      File "c:python3libsite-packagespip\__init__.py", line 219, in main
        cmd_name, cmd_args = parseopts(args)
      File "c:python3libsite-packagespip\__init__.py", line 159, in parseopts
        parser = create_main_parser()
      File "c:python3libsite-packagespip\__init__.py", line 137, in create_main_parser
        parser = ConfigOptionParser(**parser_kw)
      File "c:python3libsite-packagespipaseparser.py", line 148, in __init__
        self.config.read(self.files)
      File "c:python3libconfigparser.py", line 697, in read
        self._read(fp, filename)
      File "c:python3libconfigparser.py", line 1015, in _read
        for lineno, line in enumerate(fp, start=1):
    UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 67: illegal multibyte sequence

    在segmentfault][1]上找到问题原因,之前配置过 %APPDATA%pippip.ini 文件,编码为utf-8。估计要用原生的cp939才行,将pip.ini删掉后重新执行pip命令恢复正常。

    C:Usershyang0>pip list
    DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
    pip (9.0.1)
    setuptools (28.8.0)
    You are using pip version 9.0.1, however version 10.0.1 is available.
    You should consider upgrading via the 'python -m pip install --upgrade pip' command.
    
    C:Usershyang0>python -m pip install --upgrade pip
    Collecting pip
      Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
        100% |████████████████████████████████| 1.3MB 876kB/s
    Installing collected packages: pip
      Found existing installation: pip 9.0.1
        Uninstalling pip-9.0.1:
          Successfully uninstalled pip-9.0.1
    Successfully installed pip-10.0.1
    
    C:Usershyang0>
    [1]: https://segmentfault.com/q/1010000012807558/a-1020000012989591 "pip gbk decode"
  • 相关阅读:
    第五届“飞思卡尔”智能车竞赛分赛区赛后总结
    最佳编程语录
    通过UserAgent判断智能手机(设备,Android,IOS)
    Sql Server 系统存储过程分析 2 数据库引擎存储过程
    OutputCache 导致页面下载的解决办法
    w3wp.exe(IIS ) CPU 占用 100% 的常见原因及解决办法
    过滤并替换页面html输出
    Sql Server 系统存储过程分析 1 目录存储过程
    Sql Server 监控 Job 执行情况
    OutPutCache 自定义缓存:session、登录用户、cookie 等
  • 原文地址:https://www.cnblogs.com/hyang0/p/9293111.html
Copyright © 2011-2022 走看看