我已经在我的 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
[...]
我尝试过的:
- 自己生成语言环境 -
update-locale LC_ALL="pl_PL.UTF-8"
- 显示:http://www.wklej.org/id/1248438/ apt-get install --reinstall locales
http://www.wklej.org/id/1248442/dpkg-reconfigure locales
与+ 设置相同pl_PL.UTF-8
,pl_PL.ISO-8859-2
甚至en_US
:http://www.wklej.org/id/1248446/export LC_ALL=pl_PL.UTF-8
(即使在根目录下):-bash: warning: setlocale: LC_ALL: cannot change locale (pl_PL.UTF-8)
这是显示区域设置的内容:
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=
/var/log 中没有发现任何有趣的内容。即使将存储库更改为官方 + 清除和手动安装区域设置也无法解决我的问题,这在每次全新安装 Debian 7 时都会体现出来。
答案1
似乎没有生成语言环境。您是否通过按相应行pl_PL.UTF-8
正确选择了?dpkg-reconfigure locales
space
如果是,则该行
pl_PL.UTF-8 UTF-8
in/etc/locale.gen
未注释(= 不以 开头#
)。如果您需要解决此问题,您还需要运行locale-gen
以生成区域设置。其输出应该是:
Generating locales (this might take a while)...
pl_PL.UTF-8... done
Generation complete.
如果它没有输出您想要生成的语言环境,则您的系统似乎有问题。原因之一可能是您已经localepurge
安装了。如果没有文件/usr/share/locale/pl/LC_MESSAGES
或/usr/share/locale/pl_PL/LC_MESSAGES
出现这种情况,或者您的系统已损坏。
答案2
第一的:
sudo apt-get purge locales
然后:
sudo aptitude install locales
以及著名的:
sudo dpkg-reconfigure locales
这会清除系统的语言环境,然后重新安装语言环境并将 libc6 从 2.19 降级到 2.13,这就是问题所在。然后再次配置区域设置。
答案3
快速而简单的方法(尽管这意味着比其他方法使用更多的磁盘):
apt install locales-all
答案4
尝试运行
locale -a
如果你有
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
这种情况的解决方案是安装 debian 风格的包语言环境(来自 glibc 包 [1] )或 glibc-all-langpacks CentOS/Fedora