2021-05-11 记录一个 conda2 字符编码问题

错误信息如下:

Traceback (most recent call last):
  File "D:\Software\Env\miniconda2\Scripts\conda-script.py", line 12, in 
    sys.exit(main())
  File "D:\Software\Env\miniconda2\lib\site-packages\conda\cli\main.py", line 149, in main
    from ..exceptions import conda_exception_handler
  File "D:\Software\Env\miniconda2\lib\site-packages\conda\exceptions.py", line 25, in 
    from .common.io import dashlist, timeout
  File "D:\Software\Env\miniconda2\lib\site-packages\conda\common\io.py", line 580, in 
    class time_recorder(ContextDecorator):  # pragma: no cover
  File "D:\Software\Env\miniconda2\lib\site-packages\conda\common\io.py", line 581, in time_recorder
    record_file = get_instrumentation_record_file()
  File "D:\Software\Env\miniconda2\lib\site-packages\conda\common\io.py", line 577, in get_instrumentation_record_file
    return expand(os.environ.get("CONDA_INSTRUMENTATION_RECORD_FILE", default_record_file))
  File "D:\Software\Env\miniconda2\lib\site-packages\conda\common\path.py", line 49, in expand
    return abspath(expanduser(expandvars(path)))
  File "D:\Software\Env\miniconda2\lib\ntpath.py", line 311, in expanduser
    return userhome + path[i:]
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb9 in position 9: invalid start byte

只需要把 D:\Software\Env\miniconda2\lib\ntpath.py 331行的代码改一下就好了

    return userhome + path[i:]

改成就可以解决字符问题

   return join(userhome, path[i:])

你可能感兴趣的:(2021-05-11 记录一个 conda2 字符编码问题)