为什么即使已设置,我也会收到区域设置错误?

std*_*err 3 locale utf-8 bitbake ubuntu-14.04

当我运行时bitbake,我得到以下信息:

$ bitbake core-image-base
Please use a locale setting which supports utf-8.
Python can't change the filesystem locale after loading so we need a utf-8 when python starts or things won't work.
Run Code Online (Sandbox Code Playgroud)

即使我的区域设置设置为en_US.UTF-8,这是为什么?

$ echo $LC_ALL
en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)

有关其他背景信息,另请参阅https://unix.stackexchange.com/questions/626916/how-to-set-locale- Correctly-manually/626919

更新:

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

我的~/.bashrc样子:

$ cat ~/.bashrc
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)

当打开一个新的外壳时,我得到:

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

小智 9

如果 shell 在您添加区域设置之前就已经存在,那么您需要打开一个新的 shell(或者bash作为子进程运行,打开一个新终端,执行一个新的 ssh,...)

那么这应该可行。

$ export LC_ALL="en_US.UTF-8"
$ bitbake core-image-base
Run Code Online (Sandbox Code Playgroud)

可能不需要导出,这取决于您系统的默认设置。


tin*_*ink 5

以“成功加冕的评论”作为答案:

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales
Run Code Online (Sandbox Code Playgroud)