0

最近,我正在尝试 CodeRunner(2.2.2 版)。我的 python 是 miniconda2,一个科学的 python。我可以导入 numpy,但我不能导入 pandas。这很棘手!

我尝试了一些解决方案,例如:https ://coderwall.com/p/-k_93g/mac-os-x-valueerror-unknown-locale-utf-8-in-python 。但它没有成功。

import numpy as np
print 'numpy imported!'
print '----------------------Success-----------------------------------'
import pandas as pd

错误

numpy imported!
----------------------Success-----------------------------------
Traceback (most recent call last):
  File "Untitled.py", line 4, in <module>
    import pandas as pd
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/pandas/__init__.py", line 39, in <module>
    from pandas.core.api import *
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/pandas/core/api.py", line 10, in <module>
    from pandas.core.groupby import Grouper
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/pandas/core/groupby.py", line 18, in <module>
    from pandas.core.frame import DataFrame
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/pandas/core/frame.py", line 39, in <module>
    from pandas.core.series import Series
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/pandas/core/series.py", line 2944, in <module>
    import pandas.tools.plotting as _gfx  # noqa
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/pandas/tools/plotting.py", line 27, in <module>
    import pandas.tseries.converter as conv
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/pandas/tseries/converter.py", line 7, in <module>
    import matplotlib.units as units
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1131, in <module>
    rcParams = rc_params()
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 975, in rc_params
    return rc_params_from_file(fname, fail_on_error)
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1100, in rc_params_from_file
    config_from_file = _rc_params_in_file(fname, fail_on_error)
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file
    with _open_file_or_url(fname) as fd:
  File "/Users/chengfei/miniconda2/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/chengfei/miniconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1000, in _open_file_or_url
    encoding = locale.getdefaultlocale()[1]
  File "/Users/chengfei/miniconda2/lib/python2.7/locale.py", line 545, in getdefaultlocale
    return _parse_localename(localename)
  File "/Users/chengfei/miniconda2/lib/python2.7/locale.py", line 477, in _parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
4

0 回答 0