2016-05-28 12 views
1

Ich bin ein Neuling und Abholung DS mit Python. Ich habe das neueste Anaconda-Paket benutzt und versucht, Pandas in Jupyter zu importieren. Dann habe ich folgende Fehlermeldung erhalten. Ich habe versucht, das Pandas-Paket erneut mit dem Befehl conda zu installieren, aber das Problem wurde nicht behoben. Danke für jede Beratung im Voraus.Treffen Sie diese UTF-8 Fehler beim Importieren von Pandas

--------------------------------------------------------------------------- 
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 

Antwort

0

Wenn Sie Mac OS X verwenden, versuchen Sie die folgenden Zeilen zu Ihrer ~/.bash_profile hinzu:

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

Danke für die Tipps. Aber ich kann dieses bash_profile nicht finden, wenn ich es im Spotlight eintippe. Entschuldigung, ich bin kein Programmierer und das ist mir fremd. – Ghostintheshell

+0

Sollte in Ihrem 'home'-Verzeichnis sein, das mit Ihrem Benutzernamen. Es existiert vielleicht noch nicht - hier ist eine Erklärung, wie man eine erstellt: https://natelandau.com/my-mac-osx-bash_profile/ – Stefan

+0

Vielen Dank. Ich hab es geschafft. – Ghostintheshell

Verwandte Themen