当我运行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: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory

解决方案:

试试这个(uk_UA。UTF-8是我当前的语言环境。编写语言环境,例如en_US。utf - 8 !)

sudo locale-gen uk_UA.UTF-8

这。

sudo dpkg-reconfigure locales

其他回答

以下是接受的答案:

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

在Arch Linux中使用英国键盘和地区,我有以下错误:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.utf8"

在/etc/profile中导出我的locale并没有修复它。 不过,我确实通过编辑/etc/locale修复了这个问题同时启用en_US. gen。perl期望找到的Utf8语言环境,并运行local-gen。

(我使用的pac-manager使用AUR的一大堆perl模块,所以在我的特殊情况下重新安装perl将是一个麻烦。)

您需要在/etc/default/locale中适当地配置语言环境、注销、登录,然后运行常规命令

root@host:~# echo -e 'LANG=en_US.UTF-8\nLC_ALL=en_US.UTF-8' > /etc/default/locale
root@host:~# exit
local-user@local:~$ ssh root@host
root@host:~# locale-gen en_US.UTF-8
root@host:~# dpkg-reconfigure locales

如果您在CentOS中运行chroot,请尝试手动将有此问题的帐户的/usr/lib/locale复制到chroot环境。