使用带有jupyter笔记本和ipython的anaconda的问题

时间:2016-03-19 00:23:21

标签: python ipython anaconda jupyter-notebook

我下载了anaconda(python2.7版本)但是使用它有麻烦。我试图将其丢弃并再次安装anaconda,但问题仍然存在:

当我尝试使用简单的代码使用matplotlib时:

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.ylabel('some numbers')
plt.show()

当我使用文本编辑器(崇高文本)时,它可以工作,但是当我使用ipython或jupyter笔记本时,它不起作用。我收到以下错误(使用jupyter ipython notebook或ipython)

    ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-1-a1c4f0c7307c> in <module>()
----> 1 import matplotlib.pyplot as plt
      2 plt.plot([1,2,3,4])
      3 plt.ylabel('some numbers')
      4 plt.show()

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

任何帮助将不胜感激

当我在终端输入区域设置时,我得到:

LANG=
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

0 个答案:

没有答案