Cannot set LC_CTYPE to default locale: No such file or directory

2018-05-30 18:54:35 查看 1162 回复 0

将系统语言环境改为英文的en_US.UTF-8

查看当前系统语言环境

#locale

编辑配置文件,将zh_US.UTF-8改为en_US.UTF-8,zh改为en

#sudo nano /etc/default/locale
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"

继续查看更改后的系统语言变量,如果出现下列错误,说明没安装en_US的local

pi@raspberry:~$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US:en

查看系统内安装的locale

pi@raspberry:~$ locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
POSIX
zh_CN.utf8

看吧,没装en_US.UTF-8

安装en_US.UTF-8

sudo locale-gen en_US.UTF-8

再次查看,应该一切正常了。