我使用Spyder在我的Mac OS x中运行我的python代码。 它发生了spyder刚崩溃,因为它们不再打开。 当我尝试直接从〜/ anaconda / bin打开它时,会出现以下错误信息: Image of the error
点击确定后,我回到错误行:
[Julias-MBP-3:~/anaconda/bin] juliaroquette% ./spyder
2017-06-19 18:24:06.479 python[713:16813] modalSession has been exited prematurely - check for a reentrant call to endModalSession:
Traceback (most recent call last):
File "/Users/juliaroquette/anaconda/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 3011, in main
mainwindow = run_spyder(app, options, args)
File "/Users/juliaroquette/anaconda/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 2913, in run_spyder
main.setup()
File "/Users/juliaroquette/anaconda/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 784, in setup
from spyder.plugins.help import Help
File "/Users/juliaroquette/anaconda/lib/python2.7/site-packages/spyder/plugins/help.py", line 33, in <module>
from spyder.utils.help.sphinxify import (CSS_PATH, generate_context,
File "/Users/juliaroquette/anaconda/lib/python2.7/site-packages/spyder/utils/help/sphinxify.py", line 29, in <module>
from docutils.utils import SystemMessage as SystemMessage
File "/Users/juliaroquette/anaconda/lib/python2.7/site-packages/docutils/utils/__init__.py", line 20, in <module>
import docutils.io
File "/Users/juliaroquette/anaconda/lib/python2.7/site-packages/docutils/io.py", line 18, in <module>
from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput
File "/Users/juliaroquette/anaconda/lib/python2.7/site-packages/docutils/utils/error_reporting.py", line 47, in <module>
locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]
File "/Users/juliaroquette/anaconda/lib/python2.7/locale.py", line 564, in getlocale
return _parse_localename(localename)
File "/Users/juliaroquette/anaconda/lib/python2.7/locale.py", line 477, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
我尝试做错误消息提示,并使用选项--reset,但之后仍然存在相同的错误。
任何人都知道如何解决这个问题?
答案 0 :(得分:0)
已知MacPorts版本的Spyder引发此错误:
ValueError:未知语言环境:UTF-8
无法正常启动。
要修复此问题,您将必须在.profile(或.bashrc)中手动设置以下环境变量:
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8