问题描述:
Traceback (most recent call last):
File "/tmp/fishinstall/install.py", line 134, in <module>
main()
File "/tmp/fishinstall/install.py", line 79, in main
PrintUtils.print_success(tr.tr("\u5df2\u4e3a\u60a8\u5207\u6362\u8bed\u8a00\u81f3\u5f53\u524d\u6240\u5728\u56fd\u5bb6\u8bed\u8a00:")+tr.lang)
File "/tmp/fishinstall/tools/base.py", line 827, in print_success
PrintUtils.print_text("\033[32m{}\033[37m".format(data),end=end)
File "/tmp/fishinstall/tools/base.py", line 835, in print_text
print(values,end=str(end),flush=flush) # force to string
UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-20: ordinal not in range(128)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/fishinstall/install.py", line 137, in <module>
print('\r\n\u68c0\u6d4b\u5230\u7a0b\u5e8f\u53d1\u751f\u5f02\u5e38\u9000\u51fa\uff0c\u8bf7\u6253\u5f00\uff1ahttps://fishros.org.cn/forum \u643a\u5e26\u5982\u4e0b\u5185\u5bb9\u8fdb\u884c\u53cd\u9988\n\n')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 2-17: ordinal not in range(128)
解决方法
1、安装依赖
sudo apt-get update
sudo apt-get install locales -y
sudo locale-gen en_US.UTF-8
2、修改 /etc/default/locale 文件加入以下内容
vim /etc/default/locale
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8:"
3、修改 /etc/bash.bashrc文件加入以下内容
vim /etc/bash.bashrc
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8:"
4、更新环境:
source /etc/bash.bashrc