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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lingdi2000/article/details/54744105

  最近在用ubuntu安装东西的时候提示这个错误

perl: warning: Setting locale failed.     
perl: warning: Please check that your locale settings:     
    LANGUAGE = "zh_CN:zh:en_US:en",     
    LC_ALL = "zh_CN.UTF-8",     
    LANG = "zh_CN.UTF-8"     
    are supported and installed on your system.     
perl: warning: Falling back to the standard locale ("C").     
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  

  从字面上看 就是请确认系统已经安装指定的语言包。
  那么知道了出现问题的原因就可以去解决了。
  先运行 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_CH.GBK
LANGUAGE=zh_CN:zh:en_US:en
LC_CTYPE="zh_CH.GBK"
LC_NUMERIC="zh_CH.GBK"
LC_TIME="zh_CH.GBK"
LC_COLLATE="zh_CH.GBK"
LC_MONETARY="zh_CH.GBK"
LC_MESSAGES="zh_CH.GBK"
LC_PAPER="zh_CH.GBK"
LC_NAME="zh_CH.GBK"
LC_ADDRESS="zh_CH.GBK"
LC_TELEPHONE="zh_CH.GBK"
LC_MEASUREMENT="zh_CH.GBK"
LC_IDENTIFICATION="zh_CH.GBK"

  这个是我自己的配置,很明显我的错误在于名称弄错了,应该是zh_CN.GBK 其含义为 语言_地区.字符集。
  zh代表中文,CN代表大陆地区,GBK 表示字符集。
  如果你的系统也有这样的问题,需要设置系统支持的语言包,否则就需要自己去安装,指令如下

sudo locale-gen en_US.UTF-8 安装英文的utf-8语言包

  查看自己系统支持哪些语言包,可以调用指令:

locale -a

  如果需要永久的使locale的修改生效在ubuntu下还需要执行如下命令:

sudo dpkg-reconfigure locales

猜你喜欢

转载自blog.csdn.net/lingdi2000/article/details/54744105
今日推荐