C语言 “Gtk-WARNING **:C 库不支持语言环境。使用后备'C' 语言环境。” 在 OS X 上
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30705370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"Gtk-WARNING **: Locale not supported by C library. Using the fallback 'C' locale." on OS X
提问by Mateusz Piotrowski
Background information:
背景资料:
I use Mac OSX Yosemite.
我使用 Mac OSX 优胜美地。
I've installed gtk+using brew install gtk+and fixed the errors using export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig.
我已经gtk+使用安装brew install gtk+并修复了错误export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig。
I've build my program using makebut when I try to run it I get a warning like this:
我已经使用构建了我的程序,make但是当我尝试运行它时,我收到如下警告:
(process:16182): Gtk-WARNING **: Locale not supported by C library.
Using the fallback 'C' locale.
Problem: I cannot find any solutions for OS X for this particular problem.
问题:对于这个特定问题,我找不到任何适用于 OS X 的解决方案。
What I've learnt so far:
到目前为止我学到了什么:
In this thread (Gtk-WARNING **: Locale not supported by C library. while using several Python modules (mayavi, spectral)) they suggests using:
but I've got no idea how python can be related to my problem (my program is written in C - the same applies toipython --pylab=wxinstead ofipython --pylab=osxgtk+I guess)You can find a lot of threads on this issue like this one: (Gtk-WARNING **: Locale not supported by C library. when starting apps from the commandline) but they mainly refer to Linux and/or Ubuntu.
Most of the answers use a command like this sooner or later:sudo dpkg-reconfigure localesBut there is no
dpkgon OS X.
在这个线程(Gtk-WARNING **: Locale not supported by C library. while using几个Python模块(mayavi,spectral))他们建议使用:
但我不知道 python 如何与我的问题相关(我的程序是用 C 编写的 -ipython --pylab=wx代替ipython --pylab=osxgtk+我猜这同样适用)您可以在此问题上找到很多线程,例如:(Gtk-WARNING **:C 库不支持区域设置。从命令行启动应用程序时)但它们主要指的是 Linux 和/或 Ubuntu。
大多数答案迟早会使用这样的命令:sudo dpkg-reconfigure locales但是
dpkg在 OS X 上没有。
采纳答案by Mateusz Piotrowski
The issue here is that the environment variable LANGis not set, because I've mixed settings for Polish and English in the Language and Regionsection in System Preferences.
这里的问题是环境变量LANG没有设置,因为我在System Preferences的Language and Region部分混合了波兰语和英语的设置。
Quoting @KenThomaseswho helped me a lot with this problem:
引用在这个问题上帮了我很多忙的@KenThomases:
There's not going to be any C library locale defined for the English language in Poland (i.e. en_PL.UTF-8). That's why Terminal is not setting LANG for you in your shells, even though you have "Set locale environment variables on startup" enabled.
波兰不会为英语定义任何 C 库语言环境(即 en_PL.UTF-8)。这就是为什么终端没有在你的 shell 中为你设置 LANG,即使你启用了“在启动时设置语言环境变量”。
You can read the in-depth solution here:
Is it bad that LANG and LC_ALL are empty when running `locale -a` on OS X Yosemite?
您可以在此处阅读深入的解决方案:
在 OS X Yosemite 上运行 `locale -a` 时 LANG 和 LC_ALL 为空是不是很糟糕?

