未找到语言环境/设置语言环境失败 - 我该怎么办?

luk*_*e_g 35 debian locale

我已经在我的 VPS (OpenVZ) 上安装了 Debian 7 i386。一切正常,除了语言环境 - 任何安装任何东西的尝试都会显示:

[...]
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "pl_PL.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
[...]
Run Code Online (Sandbox Code Playgroud)

我试过的:

  1. 自己生成语言环境 - update-locale LC_ALL="pl_PL.UTF-8"- 显示:http : //www.wklej.org/id/1248438/
  2. apt-get install --reinstall locales http://www.wklej.org/id/1248442/
  3. dpkg-reconfigure locales+ 设置相同pl_PL.UTF-8pl_PL.ISO-8859-2甚至en_UShttp : //www.wklej.org/id/1248446/
  4. export LC_ALL=pl_PL.UTF-8 (即使在根上):

    -bash: warning: setlocale: LC_ALL: cannot change locale (pl_PL.UTF-8)
    
    Run Code Online (Sandbox Code Playgroud)

这是显示语言环境的内容:

root:~# 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=pl_PL.UTF-8
LANGUAGE=
LC_CTYPE="pl_PL.UTF-8"
LC_NUMERIC="pl_PL.UTF-8"
LC_TIME="pl_PL.UTF-8"
LC_COLLATE="pl_PL.UTF-8"
LC_MONETARY="pl_PL.UTF-8"
LC_MESSAGES="pl_PL.UTF-8"
LC_PAPER="pl_PL.UTF-8"
LC_NAME="pl_PL.UTF-8"
LC_ADDRESS="pl_PL.UTF-8"
LC_TELEPHONE="pl_PL.UTF-8"
LC_MEASUREMENT="pl_PL.UTF-8"
LC_IDENTIFICATION="pl_PL.UTF-8"
LC_ALL=
Run Code Online (Sandbox Code Playgroud)

在 /var/log 中没有发现任何有趣的东西。即使将 repo 更改为官方 + 清除和手动安装语言环境也不能解决我的问题,这在每次全新安装 Debian 7 时都会体现出来。

jof*_*fel 23

似乎没有生成语言环境。您pl_PL.UTF-8是否dpkg-reconfigure locales通过按下space相应的行正确选择了输入?

如果是,该行

pl_PL.UTF-8 UTF-8
Run Code Online (Sandbox Code Playgroud)

in/etc/locale.gen没有注释(= 不以 开头#)。如果您需要修复此问题,您还需要运行locale-gen以生成语言环境。它的输出应该是:

Generating locales (this might take a while)...
   pl_PL.UTF-8... done
Generation complete.
Run Code Online (Sandbox Code Playgroud)

如果它没有输出您要生成的语言环境,则您的系统似乎有问题。原因之一可能是您已localepurge安装。如果没有文件,/usr/share/locale/pl/LC_MESSAGES或者/usr/share/locale/pl_PL/LC_MESSAGES是这种情况,或者您的系统已损坏。


小智 14

第一的:

sudo apt-get purge locales
Run Code Online (Sandbox Code Playgroud)

然后:

sudo aptitude install locales
Run Code Online (Sandbox Code Playgroud)

和著名的:

sudo dpkg-reconfigure locales
Run Code Online (Sandbox Code Playgroud)

这摆脱了语言环境系统,然后重新安装语言环境并将 libc6 从 2.19 降级到 2.13,这是问题所在。然后再次配置语言环境。


Yaj*_*ajo 7

快速简便的方法(尽管这意味着使用的磁盘比其他方法多):

apt install locales-all
Run Code Online (Sandbox Code Playgroud)