语言环境配置错误

语言环境配置错误

我刚刚在法兰克福地区启动了一台 EC2 机器。区域设置已损坏:

ubuntu@myhost:~$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=

我该如何纠正这个问题?

答案1

编辑/etc/locale.gen

sudo vi /etc/locale.gen

并确保:

de_DE.UTF-8 UTF-8

取消注释。然后只需执行:

sudo locale-gen

并验证:

$ cat /etc/locale.gen | grep -v '^#'
de_DE.UTF-8 UTF-8
en_US.UTF-8 UTF-8

$ locale -a
C
C.UTF-8
de_DE.utf8
en_US.utf8
POSIX

相关内容