解决问题 setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory

解决字符集问题

setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory

系统已经设置了默认地区_语言.字符集为en_US.UTF-8,但是在系统中没有定义对应的locale文件,

只需要手动生成这个locale文件即可

解决:

[root@VM_0_14_centos ~]# vim /etc/environment         
#添加下面两行内容
 LANG="en_US.UTF-8"
 LC_ALL=
[root@VM_0_14_centos ~]# source /etc/environment

[root@VM_0_14_centos ~]# vim /etc/sysconfig/i18n
LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
[root@VM_0_14_centos ~]# cat /etc/sysconfig/i18n

#执行下面命令,生成 en_US.UTF-8这个字符集的locale文件
[root@VM_0_14_centos ~]# localedef -v -c -i en_US -f UTF-8 en_US.UTF-8

 

posted @ 2023-01-12 16:52  一只小小的寄居蟹  阅读(10878)  评论(1编辑  收藏  举报