2016-05-28 9 views
1

私は初心者であり、Pythonを使用してDSを取り上げています。私は最新のAnacondaパッケージを使用し、Jupyterでパンダをインポートしようとしました。次に、次のエラーメッセージが表示されました。私はcondaコマンドでPandasパッケージを再インストールしようとしましたが、この問題は解決しませんでした。事前に助言をいただきありがとうございます。私はPandasをインポートしようとするとこのUTF-8エラーに遭遇します

--------------------------------------------------------------------------- 
ValueError        Traceback (most recent call last) 
<ipython-input-1-af55e7023913> in <module>() 
----> 1 import pandas as pd 

//anaconda/lib/python2.7/site-packages/pandas/__init__.pyc in <module>() 
    37 import pandas.core.config_init 
    38 
---> 39 from pandas.core.api import * 
    40 from pandas.sparse.api import * 
    41 from pandas.stats.api import * 

//anaconda/lib/python2.7/site-packages/pandas/core/api.py in <module>() 
     8 from pandas.core.common import isnull, notnull 
     9 from pandas.core.categorical import Categorical 
---> 10 from pandas.core.groupby import Grouper 
    11 from pandas.formats.format import set_eng_float_format 
    12 from pandas.core.index import (Index, CategoricalIndex, Int64Index, 

//anaconda/lib/python2.7/site-packages/pandas/core/groupby.py in <module>() 
    16        DataError, SpecificationError) 
    17 from pandas.core.categorical import Categorical 
---> 18 from pandas.core.frame import DataFrame 
    19 from pandas.core.generic import NDFrame 
    20 from pandas.core.index import (Index, MultiIndex, CategoricalIndex, 

//anaconda/lib/python2.7/site-packages/pandas/core/frame.py in <module>() 
    37         create_block_manager_from_arrays, 
    38         create_block_manager_from_blocks) 
---> 39 from pandas.core.series import Series 
    40 from pandas.core.categorical import Categorical 
    41 import pandas.computation.expressions as expressions 

//anaconda/lib/python2.7/site-packages/pandas/core/series.py in <module>() 
    2942 # Add plotting methods to Series 
    2943 
-> 2944 import pandas.tools.plotting as _gfx # noqa 
    2945 
    2946 Series.plot = base.AccessorProperty(_gfx.SeriesPlotMethods, 

//anaconda/lib/python2.7/site-packages/pandas/tools/plotting.py in <module>() 
    25 from pandas.util.decorators import Appender 
    26 try: # mpl optional 
---> 27  import pandas.tseries.converter as conv 
    28  conv.register() # needs to override so set_xlim works with str/number 
    29 except ImportError: 

//anaconda/lib/python2.7/site-packages/pandas/tseries/converter.py in <module>() 
     5 from dateutil.relativedelta import relativedelta 
     6 
----> 7 import matplotlib.units as units 
     8 import matplotlib.dates as dates 
     9 

//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py in <module>() 
    1129 
    1130 # this is the instance used by the matplotlib classes 
-> 1131 rcParams = rc_params() 
    1132 
    1133 if rcParams['examples.directory']: 

//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py in rc_params(fail_on_error) 
    973   return ret 
    974 
--> 975  return rc_params_from_file(fname, fail_on_error) 
    976 
    977 

//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py in rc_params_from_file(fname, fail_on_error, use_default_template) 
    1098   parameters specified in the file. (Useful for updating dicts.) 
    1099  """ 
-> 1100  config_from_file = _rc_params_in_file(fname, fail_on_error) 
    1101 
    1102  if not use_default_template: 

//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py in _rc_params_in_file(fname, fail_on_error) 
    1016  cnt = 0 
    1017  rc_temp = {} 
-> 1018  with _open_file_or_url(fname) as fd: 
    1019   try: 
    1020    for line in fd: 

//anaconda/lib/python2.7/contextlib.pyc in __enter__(self) 
    15  def __enter__(self): 
    16   try: 
---> 17    return self.gen.next() 
    18   except StopIteration: 
    19    raise RuntimeError("generator didn't yield") 

//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py in _open_file_or_url(fname) 
    998  else: 
    999   fname = os.path.expanduser(fname) 
-> 1000   encoding = locale.getdefaultlocale()[1] 
    1001   if encoding is None: 
    1002    encoding = "utf-8" 

//anaconda/lib/python2.7/locale.pyc in getdefaultlocale(envvars) 
    541  else: 
    542   localename = 'C' 
--> 543  return _parse_localename(localename) 
    544 
    545 

//anaconda/lib/python2.7/locale.pyc in _parse_localename(localename) 
    473  elif code == 'C': 
    474   return None, None 
--> 475  raise ValueError, 'unknown locale: %s' % localename 
    476 
    477 def _build_localename(localetuple): 

ValueError: unknown locale: UTF-8 

答えて

0

あなたがMac OS Xを使用している場合は、あなたの~/.bash_profileに以下の行を追加してみてください:ヒントについて

export LC_ALL=en_US.UTF-8 
export LANG=en_US.UTF-8 
+0

感謝を。しかし、私はこのbash_profileを私がスポットライトで入力すると見つけることができません。申し訳ありませんが、私はプログラマーではなく、これは私にとっては外国人です。 – Ghostintheshell

+0

あなたのユーザ名を持つ 'home'ディレクトリになければなりません。それはまだ存在しないかもしれません - ここでは、1つを作成する方法の説明です:https://natelandau.com/my-mac-osx-bash_profile/ – Stefan

+0

多くのありがとう。わかった。 – Ghostintheshell

関連する問題