指定locale为en US

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               


本文讨论的是locale,内容和我的另一篇有一定关联:http://blog.csdn.net/sheismylife/article/details/7635767

今天远程登录到一台UBuntu12.04 server,用locale一看,出现警告信息:

root@s15438266:~# localelocale: Cannot set LC_CTYPE to default locale: No such file or directorylocale: Cannot set LC_MESSAGES to default locale: No such file or directorylocale: Cannot set LC_ALL to default locale: No such file or directoryLANG=en_CA.UTF-8LANGUAGE=LC_CTYPE="en_CA.UTF-8"LC_NUMERIC=zh_CN.UTF-8LC_TIME=zh_CN.UTF-8LC_COLLATE="en_CA.UTF-8"LC_MONETARY=zh_CN.UTF-8LC_MESSAGES="en_CA.UTF-8"LC_PAPER=zh_CN.UTF-8LC_NAME=zh_CN.UTF-8LC_ADDRESS=zh_CN.UTF-8LC_TELEPHONE=zh_CN.UTF-8LC_MEASUREMENT=zh_CN.UTF-8LC_IDENTIFICATION=zh_CN.UTF-8LC_ALL=

这篇帖子解释的比较清楚,大意是ssh远程登录时想将我客户端的locale用在server上。结果server段没有en_US,就报了错。

http://askubuntu.com/questions/144235/locale-variables-have-no-effect-in-remote-shell-perl-warning-setting-locale-f

那就安装一下所有的en语言包:

root@s15438266:~# apt-get --reinstall install language-pack-enReading package lists... DoneBuilding dependency tree       Reading state information... DoneThe following extra packages will be installed:  firefox-locale-en language-pack-en-baseThe following NEW packages will be installed:  firefox-locale-en language-pack-en language-pack-en-base0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.Need to get 1361 kB of archives.After this operation, 4956 kB of additional disk space will be used.Do you want to continue [Y/n]? yGet:1 http://mirror-us.oneandone.net/linux/distributions/ubuntu/ubuntu/ precise-updates/main language-pack-en-base all 1:12.04+20120801 [878 kB]Get:2 http://mirror-us.oneandone.net/linux/distributions/ubuntu/ubuntu/ precise-updates/main language-pack-en all 1:12.04+20120801 [1994 B]Get:3 http://mirror-us.oneandone.net/linux/distributions/ubuntu/ubuntu/ precise-updates/main firefox-locale-en amd64 16.0.1+build1-0ubuntu0.12.04.1 [480 kB]Fetched 1361 kB in 0s (4264 kB/s)      perl: warning: Setting locale failed.perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_TIME = "zh_CN.UTF-8", LC_MONETARY = "zh_CN.UTF-8", LC_ADDRESS = "zh_CN.UTF-8", LC_TELEPHONE = "zh_CN.UTF-8", LC_NAME = "zh_CN.UTF-8", LC_MEASUREMENT = "zh_CN.UTF-8", LC_IDENTIFICATION = "zh_CN.UTF-8", LC_NUMERIC = "zh_CN.UTF-8", LC_PAPER = "zh_CN.UTF-8", LANG = "en_CA.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 directorylocale: Cannot set LC_MESSAGES to default locale: No such file or directorylocale: Cannot set LC_ALL to default locale: No such file or directorySelecting previously unselected package language-pack-en-base.(Reading database ... 27043 files and directories currently installed.)Unpacking language-pack-en-base (from .../language-pack-en-base_1%3a12.04+20120801_all.deb) ...Selecting previously unselected package language-pack-en.Unpacking language-pack-en (from .../language-pack-en_1%3a12.04+20120801_all.deb) ...Selecting previously unselected package firefox-locale-en.Unpacking firefox-locale-en (from .../firefox-locale-en_16.0.1+build1-0ubuntu0.12.04.1_amd64.deb) ...Setting up firefox-locale-en (16.0.1+build1-0ubuntu0.12.04.1) ...Setting up language-pack-en (1:12.04+20120801) ...Setting up language-pack-en-base (1:12.04+20120801) ...Generating locales...  en_AG.UTF-8... done  en_AU.UTF-8... done  en_BW.UTF-8... done  en_CA.UTF-8... done  en_DK.UTF-8... done  en_GB.UTF-8... done  en_HK.UTF-8... done  en_IE.UTF-8... done  en_IN.UTF-8... done  en_NG.UTF-8... done  en_NZ.UTF-8... done  en_PH.UTF-8... done  en_SG.UTF-8... done  en_US.UTF-8... done  en_ZA.UTF-8... done  en_ZM.UTF-8... done  en_ZW.UTF-8... doneGeneration complete.

推出后,再次登录,检查locale

root@s15438266:~# localelocale: Cannot set LC_ALL to default locale: No such file or directoryLANG=en_CA.UTF-8LANGUAGE=LC_CTYPE="en_CA.UTF-8"LC_NUMERIC=zh_CN.UTF-8LC_TIME=zh_CN.UTF-8LC_COLLATE="en_CA.UTF-8"LC_MONETARY=zh_CN.UTF-8LC_MESSAGES="en_CA.UTF-8"LC_PAPER=zh_CN.UTF-8LC_NAME=zh_CN.UTF-8LC_ADDRESS=zh_CN.UTF-8LC_TELEPHONE=zh_CN.UTF-8LC_MEASUREMENT=zh_CN.UTF-8LC_IDENTIFICATION=zh_CN.UTF-8LC_ALL=

还有一个问题,就是LC_ALL没有正确设置。现在设置一下:

root@s15438266:~# update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8perl: warning: Setting locale failed.perl: warning: Please check that your locale settings: LANGUAGE = (unset), LC_ALL = (unset), LC_PAPER = "zh_CN.UTF-8", LC_ADDRESS = "zh_CN.UTF-8", LC_MONETARY = "zh_CN.UTF-8", LC_NUMERIC = "zh_CN.UTF-8", LC_TELEPHONE = "zh_CN.UTF-8", LC_IDENTIFICATION = "zh_CN.UTF-8", LC_MEASUREMENT = "zh_CN.UTF-8", LC_TIME = "zh_CN.UTF-8", LC_NAME = "zh_CN.UTF-8", LANG = "en_CA.UTF-8"    are supported and installed on your system.perl: warning: Falling back to the standard locale ("C").

然后再次退出,重新登录,检查:

root@s15438266:~# localeLANG=en_US.UTF-8LANGUAGE=LC_CTYPE="en_US.UTF-8"LC_NUMERIC="en_US.UTF-8"LC_TIME="en_US.UTF-8"LC_COLLATE="en_US.UTF-8"LC_MONETARY="en_US.UTF-8"LC_MESSAGES="en_US.UTF-8"LC_PAPER="en_US.UTF-8"LC_NAME="en_US.UTF-8"LC_ADDRESS="en_US.UTF-8"LC_TELEPHONE="en_US.UTF-8"LC_MEASUREMENT="en_US.UTF-8"LC_IDENTIFICATION="en_US.UTF-8"LC_ALL=en_US.UTF-8

总结,下面两个命令很重要:

apt-get --reinstall install language-pack-enupdate-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
似乎比前一篇我的博客中修改/etc/environment的方法更简单。


           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow
这里写图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值