bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)问题的解决

按tab补全目录的时候出现以下提示:bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)

root@kerwin:/home# scp babash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)
bash: warning: setlocale: LC_CTYPE: cannot change locale (zh_CN.UTF-8)

本地执行一下locale命令:如下

root@kerwin:/home# 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=zh_CN.UTF-8
LANGUAGE=zh_CN:zh
LC_CTYPE=”zh_CN.UTF-8″
LC_NUMERIC=zh_CN
LC_TIME=zh_CN
LC_COLLATE=”zh_CN.UTF-8″
LC_MONETARY=zh_CN
LC_MESSAGES=”zh_CN.UTF-8″
LC_PAPER=zh_CN
LC_NAME=zh_CN
LC_ADDRESS=zh_CN
LC_TELEPHONE=zh_CN
LC_MEASUREMENT=zh_CN
LC_IDENTIFICATION=zh_CN
LC_ALL=

解决方法:

1.编辑文件 /var/lib/locales/supported.d/local   这个文件是所有已经激活的区域语言的列表

zh_CN.UTF-8 UTF-8
zh_CN GB2312
zh_CN.GBK GBK
zh_CN.GB18030 GB18030
2.生成相关的locales
执行locale -gen
3.编辑/etc/default/locale
写进
LANG=”zh_CN.UTF-8″
LANGUAGE=”zh_CN:zh”
LC_ALL=”zh_CN.UTF-8″
4.重启系统后恢复。reboot

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>