2016-04-08 11 views
2

ich OSX El Capitan haben, und erhalten Sie die folgende Fehlermeldung, wenn sie versuchen matplotlib in Python zu importieren 3:matplotlib importiert nicht in python3

>>> import matplotlib 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib/__init__.py", line 1131, in <module> 
    rcParams = rc_params() 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib/__init__.py", line 975, in rc_params 
    return rc_params_from_file(fname, fail_on_error) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/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 "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file 
    with _open_file_or_url(fname) as fd: 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/contextlib.py", line 59, in __enter__ 
    return next(self.gen) 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/matplotlib/__init__.py", line 1000, in _open_file_or_url 
    encoding = locale.getdefaultlocale()[1] 
    File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/locale.py", line 559, in getdefaultlocale 
    return _parse_localename(localename) 
    File "/Library/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 

Ich versuchte, den matplotlib Ordner zu löschen, und installieren Sie es erneut mit pip installieren Matplotlib, die es neu erstellt, aber es endet mit dem gleichen Fehler. Ich verbringe schon das halbe Wochenende damit, eine Antwort zu finden, aber kein Glück - vielleicht kann jemand helfen. Am besten

+0

Siehe auch hier: http://stackoverflow.com/questions/15526996/ipython-notebook -locale-error – tom

Antwort

1

Eine Lösung gefunden . Im Grunde, was Sie tun müssen, ist fügen Sie zwei Zeilen in ~/.bash_profile (und wieder zu öffnen Terminal-Fenster):

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

Funktioniert wie ein Zauber, vielen Dank und ein schönes Wochenende. – rene