'pandas' import (Mac OS X) 当 运行 fish shell 时出错 'unknown locale: UTF-8'

Error 'unknown locale: UTF-8' on 'pandas' import (Mac OS X) when running fish shell

我最近升级到 Python 3.5 和 pandas pandas (0.17.1) 的最新版本,但这对我来说破坏了软件包。我在 Mac OS X 10.9.5,使用鱼 shell。我能做什么?

cls@clsmba ~> python3
Python 3.5.0 (default, Sep 23 2015, 04:41:33) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/site-packages/pandas/__init__.py", line 44, in <module>
    from pandas.core.api import *
  File "/usr/local/lib/python3.5/site-packages/pandas/core/api.py", line 9, in <module>
    from pandas.core.groupby import Grouper
  File "/usr/local/lib/python3.5/site-packages/pandas/core/groupby.py", line 17, in <module>
    from pandas.core.frame import DataFrame
  File "/usr/local/lib/python3.5/site-packages/pandas/core/frame.py", line 41, in <module>
    from pandas.core.series import Series
  File "/usr/local/lib/python3.5/site-packages/pandas/core/series.py", line 2909, in <module>
    import pandas.tools.plotting as _gfx
  File "/usr/local/lib/python3.5/site-packages/pandas/tools/plotting.py", line 28, in <module>
    import pandas.tseries.converter as conv
  File "/usr/local/lib/python3.5/site-packages/pandas/tseries/converter.py", line 7, in <module>
    import matplotlib.units as units
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 1131, in <module>
    rcParams = rc_params()
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 975, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 1100, in rc_params_from_file
    config_from_file = _rc_params_in_file(fname, fail_on_error)
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/usr/local/lib/python3.5/site-packages/matplotlib/__init__.py", line 1000, in _open_file_or_url
    encoding = locale.getdefaultlocale()[1]
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/locale.py", line 559, in getdefaultlocale
    return _parse_localename(localename)
  File "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/lib/python3.5/locale.py", line 487, in _parse_localename
    raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8

鱼 shell

set -x LC_ALL en_US.UTF-8 
set -x LANG en_US.UTF-8

确保您的终端设置为导出适当的语言环境变量,如 this answer 中所述,并且您的区域在系统偏好设置中设置正确。