当我运行perl时,我得到警告:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

我该怎么解决呢?


当前回答

perl -e exit
sudo localedef -i en_US -f UTF-8 en_DE.UTF-8
#                                   DE = German
# Use your country code en lieu of  DE

# The second "perl" should then not complain any more
perl -e exit

localectl list-locales # Just make sure it is OK

其他回答

在Debian上,经过大量搜索,这个方法奏效了。

第一:

sudo apt-get purge locales

然后:

sudo aptitude install locales

还有著名的:

sudo dpkg-reconfigure locales

这消除了系统的区域设置,然后重新安装区域设置,并将libc6从2.19降级到2.13,这就是问题所在。然后它再次配置区域设置。

另一个与git相关的答案:

问题的根源可能是Git服务器。如果所有这些都失败了,请尝试在服务器上执行dpkg-reconfigure区域设置(或适合您的发行版的任何设置)。

导出变量

$ export LANGUAGE=en_US.UTF-8
$ export LC_ALL=en_US.UTF-8
$ export LANG=en_US.UTF-8
$ export LC_CTYPE=en_US.UTF-8

下一个运行

$ sudo locale-gen
$ sudo dpkg-reconfigure locales 

当您运行dpkg-reconfigure locale时,它会要求您选择locale,选择en_US。utf - 8。如果通过选择所有区域设置来运行此操作,则需要一些时间来配置。

如果不关心语言环境问题,可以设置PERL_BADLANG=0。当然,这可能导致不正确的本地化。

将缺失的地区添加到.bash_profile文件中:

echo "export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8">>~/.bash_profile

然后来源你的.bash_profile文件:

source ~/.bash_profile