问题
I am trying to use Django's Admin documentation. I followed this tutorial and installed docutils. After installing I run Django development server through python manage.py runserver and get error unknown locale: UTF-8.
I solved issue as explained in this question:
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
But my question is: What is origin of this problem? It seems docutils has some compatibility problem with Python or something else?
回答1:
This is old issue, but still happening on OSX El Capitan. The origin of this problem is that Python assumes locale environment variable to be in format of language_region.encoding. This assumption is strict on Python's part as OSX defaults to UTF-8 when valid language and region pair is not available.
Lengthy discussion about this issue at bugs.python.org
来源:https://stackoverflow.com/questions/21251272/why-lc-ctype-needs-to-be-set-manually-for-python-in-some-cases