How to fix a locale problem in a Red Hat distribution?

Today I have a strange problem in my RHEL system. My python script is returning:

>>> locale.setlocale(locale.LC_ALL, '') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib64/python2.6/locale.py", line 513, in setlocale return _setlocale(category, locale) locale.Error: unsupported locale setting 

WHEN I LAUNCH ...

 $ locale 

Conclusion...

 locale: Cannot set LC_ALL to default locale: No such file or directory LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" ... 

I tried many suggestions, but none of them solved my problem.

For instance:

  • Reinstall glibc-common.
  • Export LC_ALL as an environment variable in ~ / .bashrc.
  • Change the file / etc / sysconfig / i 18n '.
  • locale-gen does not exist in RHEL.

Does anyone have a good suggestion to solve my problem. Remembering that I am using RHEL and not Ubuntu (there are many tutorials on language issues and Ubuntu).

+5
source share
3 answers

Add this to your / etc / environment

LC_ALL = en_US.UTF-8

LC_CTYPE = en_US.UTF-8

Then log out and re-enter the shell and try to execute your commands.

+11
source

In my case, iTerm automatically set the language variables. I fixed it by going to the iTerm menu and then

 Preferences ... > Profiles > "select your profile" > Terminal > uncheck "Set locale variables automatically" 
+1
source

Adding the following variables to / etc / environment fixed my problem:

LC_ALL = en_US.UTF-8

LC_CTYPE = en_US.UTF-8

Good answer above.

-2
source

Source: https://habr.com/ru/post/1202426/


All Articles