我最近在语言环境方面遇到了麻烦。很久以前我就遇到了他们的问题,但没有费心去解决(愚蠢的我,也许那时我更接近解决这个问题)。最近我一直在尝试在 Perl 中编写一些代码,运行脚本后会弹出一条信息:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = "en_US.UTF-8",
LC_CTYPE = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
我一直在尝试配置 /etc/default/locale,添加行,因为我潜伏在其他 SO 的线程周围:
LC_ALL="en_US.UTF-8"
LANG="en_US.UTF-8"
LANGUAGE="en_US.UTF-8"
到文件中,然后运行:
locale-gen en_US.UTF-8
But while running this command, I only receive:
Generating locales (this might take a while)....
pl_PL.UTF-8... done # (which is my native language)
Generation complete.
然后我跑了:
sudo dpkg-重新配置语言环境
我选择了 en_US.UTF-8 语言环境来生成,重新启动,bam。终端没有打开。我已将设置中的默认语言更改为波兰语,并打开了终端,但在启动时会弹出警告:
bash:警告:setlocale:LC_ALL:无法更改语言环境(en_US.UTF-8):没有文件或目录
顺便说一句,这个错误是用我的母语打印的,但我已经翻译了它。很可能是因为语言的变化。
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_COLLATE to default locale: No such file or directory
C
C.UTF-8
POSIX
pl_PL.utf8
我已经解决了这个问题。事实证明我只是没有在我的系统上安装足够的语言环境。
解决了我的问题。由于某种原因
dpkg-reconfigure locales
对我不起作用。这个问题有一个后续问题,因为我一直在摸不着头脑,为什么上面的命令不起作用:Locales are not being generated by dpkg-reconfigure locales