安装完Mini Conda环境,在window终端下执行conda activate没问题,但是在git bash终端下执行,就会报如下错误
$ conda activate python2.7
Exception in thread Thread-3 (_readerthread):
Traceback (most recent call last):
File "C:\Software\Conda\Lib\threading.py", line 1073, in _bootstrap_inner
self.run()
File "C:\Software\Conda\Lib\threading.py", line 1010, in run
self._target(*self._args, **self._kwargs)
File "C:\Software\Conda\Lib\subprocess.py", line 1599, in _readerthread
buffer.append(fh.read())
^^^^^^^^^
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 495: illegal multibyte sequence
Unexpected cygpath error ('NoneType' object has no attribute 'strip')
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
解决方案
打开Conda目录下的Lib\subprocess.py
, 例如我这里就是C:\Software\Conda\Lib\threading.py
修改第814行Open类的初始化函数,将encoding=None
修改为encoding='utf-8'
即可解决