matplotlib出错
当我尝试使用魔术命令%pylab时,出现以下错误:matplotlib出错,matplotlib,ipython,Matplotlib,Ipython,当我尝试使用魔术命令%pylab时,出现以下错误: In [1]: %pylab --------------------------------------------------------------------------- UnicodeDecodeError Traceback (most recent call last) <ipython-input-1-5c1faa999e5b> in <module>()
In [1]: %pylab
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-1-5c1faa999e5b> in <module>()
----> 1 get_ipython().magic(u'pylab')
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2203 magic_name, _, magic_arg_s = arg_s.partition(' ')
2204 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2205 return self.run_line_magic(magic_name, magic_arg_s)
2206
2207 #-------------------------------------------------------------------------
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2124 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2125 with self.builtin_trap:
-> 2126 result = fn(*args,**kwargs)
2127 return result
2128
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in pylab(self, line)
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc in pylab(self, line)
134 import_all = not args.no_import_all
135
--> 136 gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)
137 self._show_matplotlib_backend(args.gui, backend)
138 print ("Populating the interactive namespace from numpy and matplotlib")
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_pylab(self, gui, import_all, welcome_message)
2980 from IPython.core.pylabtools import import_pylab
2981
-> 2982 gui, backend = self.enable_matplotlib(gui)
2983
2984 # We want to prevent the loading of pylab to pollute the user's
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_matplotlib(self, gui)
2941 gui, backend = pt.find_gui_and_backend(self.pylab_gui_select)
2942
-> 2943 pt.activate_matplotlib(backend)
2944 pt.configure_inline_support(self, backend)
2945
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/pylabtools.pyc in activate_matplotlib(backend)
287 matplotlib.rcParams['backend'] = backend
288
--> 289 import matplotlib.pyplot
290 matplotlib.pyplot.switch_backend(backend)
291
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.p in <module>()
25
26 import matplotlib
---> 27 import matplotlib.colorbar
28 from matplotlib import style
29 from matplotlib import _pylab_helpers, interactive
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py in <module>()
32 import matplotlib.artist as martist
33 import matplotlib.cbook as cbook
---> 34 import matplotlib.collections as collections
35 import matplotlib.colors as colors
36 import matplotlib.contour as contour
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/collections.py in <module>()
25 import matplotlib.artist as artist
26 from matplotlib.artist import allow_rasterization
---> 27 import matplotlib.backend_bases as backend_bases
28 import matplotlib.path as mpath
29 from matplotlib import _path
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py in <module>()
54
55 import matplotlib.tight_bbox as tight_bbox
---> 56 import matplotlib.textpath as textpath
57 from matplotlib.path import Path
58 from matplotlib.cbook import mplDeprecation
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py in <module>()
17 from matplotlib.path import Path
18 from matplotlib import rcParams
---> 19 import matplotlib.font_manager as font_manager
20 from matplotlib.ft2font import FT2Font, KERNING_DEFAULT, LOAD_NO_HINTING
21 from matplotlib.ft2font import LOAD_TARGET_LIGHT
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py in <module>()
1410 verbose.report("Using fontManager instance from %s" % _fmcache)
1411 except:
-> 1412 _rebuild()
1413 else:
1414 _rebuild()
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py in _rebuild()
1395 def _rebuild():
1396 global fontManager
-> 1397 fontManager = FontManager()
1398 if _fmcache:
1399 pickle_dump(fontManager, _fmcache)
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py in __init__(self, size, weight)
1035 # Load TrueType fonts and create font dictionary.
1036
-> 1037 self.ttffiles = findSystemFonts(paths) + findSystemFonts()
1038 self.defaultFamily = {
1039 'ttf': 'Bitstream Vera Sans',
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py in findSystemFonts(fontpaths, fontext)
320 fontfiles[f] = 1
321
--> 322 for f in get_fontconfig_fonts(fontext):
323 fontfiles[f] = 1
324
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py in get_fontconfig_fonts(fontext)
272 pipe = subprocess.Popen(['fc-list', '--format=%{file}\\n'],
273 stdout=subprocess.PIPE,
--> 274 stderr=subprocess.PIPE)
275 output = pipe.communicate()[0]
276 except (OSError, IOError):
/Users/rafaelrodrigues/anaconda/lib/python2.7/subprocess.pyc in __init__(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags)
708 p2cread, p2cwrite,
709 c2pread, c2pwrite,
--> 710 errread, errwrite)
711 except Exception:
712 # Preserve original exception in case os.close raises.
/Users/rafaelrodrigues/anaconda/lib/python2.7/subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, to_close, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite)
1325 raise
1326 child_exception = pickle.loads(data)
-> 1327 raise child_exception
1328
1329
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
[1]中的:%pylab
---------------------------------------------------------------------------
UnicodeDecodeError回溯(最近一次呼叫最后一次)
在()
---->1获取_-ipython().magic(u'pylab')
/魔术版用户/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc(self,arg_s)
2203 magic_名称,magic_arg_s=arg_s.分区(“”)
2204 magic_name=magic_name.lstrip(prefilter.ESC_magic)
->2205返回自我。运行幻术(幻术名称、幻术参数)
2206
2207 #-------------------------------------------------------------------------
/run\u line\u magic中的Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc(self,magic\u name,line)
2124 kwargs['local\u ns']=sys.\u getframe(堆栈深度).f\u locals
2125带自建存水弯:
->2126结果=fn(*args,**kwargs)
2127返回结果
2128
/pylab中的Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc(self,line)
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/magic.pyc in(f,*a,**k)
191#但这一点对国家来说太过分了。
192 def魔术装饰(arg):
-->193调用=λf,*a,**k:f(*a,**k)
194
195如果可调用(arg):
/pylab中的Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/magics/pylab.pyc(self,line)
134导入全部=非参数。否导入全部
135
-->136 gui,后端,clobbered=self.shell.enable_pylab(args.gui,import_all=import_all)
137 self.\u show\u matplotlib\u后端(args.gui,后端)
138打印(“从numpy和matplotlib填充交互式命名空间”)
/enable_pylab中的Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc(self、gui、import_all、welcome_消息)
2980来自IPython.core.pylabtools import_pylab
2981
->2982 gui,后端=self.enable_matplotlib(gui)
2983
2984#我们希望防止装载pylab污染用户的电脑
/enable_matplotlib(self,gui)中的Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc
2941 gui,backend=pt.find_gui_和_backend(self.pylab_gui_select)
2942
->2943部分激活_matplotlib(后端)
2944部分配置内嵌支持(自身、后端)
2945
/activate_matplotlib(后端)中的Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/IPython/core/pylabtools.pyc
287 matplotlib.rcParams['backend']=后端
288
-->289导入matplotlib.pyplot
290 matplotlib.pyplot.switch_后端(后端)
291
/Users/rafaelrodrigues/anaconda/lib/python2.7/site packages/matplotlib/pyplot.p in()
25
26导入matplotlib
--->27导入matplotlib.colorbar
28来自matplotlib导入样式
29来自matplotlib导入_pylab_帮助程序,交互式
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py in()
32导入matplotlib.artist作为martist
33将matplotlib.cbook导入为cbook
--->34将matplotlib.collections导入为集合
35导入matplotlib.colors作为颜色
36将matplotlib.contour导入为等高线
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/collections.py in()
25将matplotlib.artist作为艺术家导入
26从matplotlib.artist导入允许光栅化
--->27导入matplotlib.backend_base作为后端_base
28将matplotlib.path导入为mpath
29从matplotlib导入路径
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/backend_base.py in()
54
55导入matplotlib.tight_bbox作为tight_bbox
--->56将matplotlib.textpath导入为textpath
57从matplotlib.path导入路径
58从matplotlib.cbook导入mpldeprication
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py in()
17从matplotlib.path导入路径
18从matplotlib导入rcParams
--->19将matplotlib.font\u管理器导入为font\u管理器
20从matplotlib.ft2font导入ft2font、紧排默认值、加载无提示
21从matplotlib.FT2导入加载目标灯
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py in()
1410 verbose.report(“使用来自%s的fontManager实例”%\u fmcache)
1411除了:
->1412()
1413其他:
1414_重建()
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font\u manager.py in urebuild()
1395 def_rebuild():
1396全局字体管理器
->1397 fontManager=fontManager()
1398如果_fmcache:
1399 pickle_dump(fontManager,_fmcache)
/Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font\u manager.py in\uuuuuuuuu init\uuuuuuuu(自身、大小、重量)
1035#加载TrueType字体并创建字体字典。
1036
->1037 self.ttffiles=findSystemFonts(路径)+findSystemFonts()
1038 self.defaultFamily={
1039'ttf':'Bitstream Vera Sans',
/findSystemFonts(FontPath,FontText)中的Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py
320个文件[f]=1
321
-->322对于get_fontconfig_字体(fontext)中的f:
323个文件[f]=1
324
/get_fontconfig_fonts(FontText)中的Users/rafaelrodrigues/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py
272 pipe=subprocess.Popen(['fc-list','--format=%{file}\\n'],
273标准输出=子流程管道,
-->274 stderr=子流程管道)