PS : 我是Anaconda 安装TensorFlow
出现UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 9: ordinal not in range(128)错误
在script/conda-script.py 改成
import sys
reload(sys)
sys.setdefaultencoding('gbk')
if __name__ == '__main__':
import sys
import conda.cli
sys.exit(conda.cli.main())
具体错误:
'''
Traceback (most recent call last):
File "D:\python\Scripts\conda-script.py", line 5, in <module>
sys.exit(conda.cli.main())
File "D:\python\lib\site-packages\conda\cli\main.py", line 164, in main
return conda_exception_handler(_main, *args)
File "D:\python\lib\site-packages\conda\exceptions.py", line 589, in conda_exception_handler
print_unexpected_error_message(e)
File "D:\python\lib\site-packages\conda\exceptions.py", line 526, in print_unexpected_error_message
from conda.base.context import context
File "D:\python\lib\site-packages\conda\base\context.py", line 584, in <module>
context = Context(SEARCH_PATH, APP_NAME, None)
File "D:\python\lib\site-packages\conda\common\configuration.py", line 715, in __init__
self._set_search_path(search_path)
File "D:\python\lib\site-packages\conda\common\configuration.py", line 733, in _set_search_path
self._set_raw_data(load_file_configs(search_path))
File "D:\python\lib\site-packages\conda\common\configuration.py", line 363, in load_file_configs
expanded_paths = tuple(expand(path) for path in search_path)
File "D:\python\lib\site-packages\conda\common\configuration.py", line 363, in <genexpr>
expanded_paths = tuple(expand(path) for path in search_path)
File "D:\python\lib\site-packages\conda\_vendor\auxlib\path.py", line 97, in expand
return abspath(expanduser(expandvars(path)))
File "D:\python\lib\ntpath.py", line 311, in expanduser
return userhome + path[i:]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 9: ordinal not in range(128)
'''