当我运行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").

我该怎么解决呢?


当前回答

以下是接受的答案:

LANG=C ssh hunter2。

LC_ALL=C ssh hunter2

在客户端,我成功了。

其他回答

如果您正在使用反引导创建rootfs,则需要生成区域设置。你可以通过运行:

# (optional) enable missing locales
sudo nano /etc/locale.gen

# then regenerate
sudo locale-gen

这个技巧来自https://help.ubuntu.com/community/Xen

向~/添加正确的区域设置。bashrc,(~ /。Bash_profile, /etc/environment之类的文件可以解决这个问题,但是不建议这样做,因为它会覆盖/etc/default/locale的设置,这在最好的情况下是令人困惑的,在最坏的情况下可能会导致区域设置不一致。

相反,应该直接编辑/etc/default/locale,它可能看起来像这样:

LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE=en_US

更改将在下次登录时生效。你可以通过/etc/default/locale在现有的shell中获取新的语言环境,就像这样:

$ . /etc/default/locale

将以下内容添加到/etc/environment中,为我解决了Debian和Ubuntu上的问题(当然,修改以匹配您想使用的语言环境):

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

将缺失的地区添加到.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

我在Mac M1 Monterey上试过这些方法,但都不行。 禁用该消息的快速方法是: 打开终端->首选项->高级选项卡->取消勾选以在启动时设置区域环境变量