2016-02-04 37 views
0

不導入當我嘗試import brian2在蟒蛇的蟒蛇分佈我收到此錯誤信息:brian2在水蟒蟒分佈

>> import brian2 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named brian 

>>> import brian2 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "//anaconda/lib/python2.7/site-packages/brian2/__init__.py", line 37, in <module> 
    from pylab import * 
    File "//anaconda/lib/python2.7/site-packages/pylab.py", line 1, in <module> 
    from matplotlib.pylab import * 
    File "//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 1131, in <module> 
    rcParams = rc_params() 
    File "//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 975, in rc_params 
    return rc_params_from_file(fname, fail_on_error) 
    File "//anaconda/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 "//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file 
    with _open_file_or_url(fname) as fd: 
    File "//anaconda/lib/python2.7/contextlib.py", line 17, in __enter__ 
    return self.gen.next() 
    File "//anaconda/lib/python2.7/site-packages/matplotlib/__init__.py", line 1000, in _open_file_or_url 
    encoding = locale.getdefaultlocale()[1] 
    File "//anaconda/lib/python2.7/locale.py", line 543, in getdefaultlocale 
    return _parse_localename(localename) 
    File "//anaconda/lib/python2.7/locale.py", line 475, in _parse_localename 
    raise ValueError, 'unknown locale: %s' % localename 
ValueError: unknown locale: UTF-8 

我不明白爲什麼?這是否與matplotlibpylab有關?

+1

LANG或LANGUAGE環境變量設置爲無效的「UTF-8」。嘗試在您的shell中輸出LANG = en_US.UTF-8'並再次運行Python。如果你告訴我你住在哪個國家以及你的母語是什麼,那麼LANG可能會有一個更合適的定義。 – msw

+0

安裝brian2時是否遵循了這些說明? http://brian2.readthedocs.org/en/2.0b4/introduction/install.html –

+0

anaconda版本不起作用,因此我使用'brian2'的普通'pip'安裝。 現在它使用Apple提供的python和平進口。 –

回答

0

這是OSX中的錯誤,他們沒有設置當地ENV變量標準值:

由於@msw在評論中說修復是

export LANG=en_US.UTF-8 

在你的bashrc中。

另見:

https://github.com/matplotlib/matplotlib/issues/5420 https://github.com/bempp/bempp/issues/260 https://github.com/matplotlib/matplotlib/issues/5919 https://github.com/pydata/pandas/issues/11608 https://github.com/pydata/pandas/issues/11694

https://github.com/matplotlib/matplotlib/pull/5931是一個建議修復。這應該是在下一個mpl版本中「固定」的。

如果擁有mac的任何人(每個人?)知道如何向Apple報告錯誤,這將是一件好事。

+0

我已經通過郵件和超鏈接此頁面向Apple報告了此錯誤。 –