我最近在我的笔记本电脑上设置了Ipython并编写了这个片段来测试matplotlib安装只是为了迎接这个错误,回溯的结尾说PermissionError:[Errno 13]权限被拒绝:'C:\ Users \ KARTHIK KC \ .matplotlib \ fontList.py3k.cache”。我无法解决此错误。有什么建议吗?
import matplotlib.pyplot as plt
x = range(-10, 10,1)
y = []
for xi in x:
yi = xi**2
y.append(yi)
plt.plot(x,y)
plt.show()
这就是错误 -
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "C:\Python34\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 278, in resize
self.show()
File "C:\Python34\Lib\site-packages\matplotlib\backends\backend_tkagg.py", line 349, in draw
FigureCanvasAgg.draw(self)
File "C:\Python34\Lib\site-packages\matplotlib\backends\backend_agg.py", line 469, in draw
self.figure.draw(self.renderer)
File "C:\Python34\Lib\site-packages\matplotlib\artist.py", line 59, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python34\Lib\site-packages\matplotlib\figure.py", line 1085, in draw
func(*args)
File "C:\Python34\Lib\site-packages\matplotlib\artist.py", line 59, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python34\Lib\site-packages\matplotlib\axes\_base.py", line 2110, in draw
a.draw(renderer)
File "C:\Python34\Lib\site-packages\matplotlib\artist.py", line 59, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "C:\Python34\Lib\site-packages\matplotlib\axis.py", line 1116, in draw
renderer)
File "C:\Python34\Lib\site-packages\matplotlib\axis.py", line 1065, in _get_tick_bboxes
extent = tick.label1.get_window_extent(renderer)
File "C:\Python34\Lib\site-packages\matplotlib\text.py", line 798, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File "C:\Python34\Lib\site-packages\matplotlib\text.py", line 311, in _get_layout
ismath=False)
File "C:\Python34\Lib\site-packages\matplotlib\backends\backend_agg.py", line 232, in get_text_width_height_descent
font = self._get_agg_font(prop)
File "C:\Python34\Lib\site-packages\matplotlib\backends\backend_agg.py", line 276, in _get_agg_font
fname = findfont(prop)
File "C:\Python34\Lib\site-packages\matplotlib\font_manager.py", line 1421, in findfont
font = fontManager.findfont(prop, **kw)
File "C:\Python34\Lib\site-packages\matplotlib\font_manager.py", line 1304, in findfont
_rebuild()
File "C:\Python34\Lib\site-packages\matplotlib\font_manager.py", line 1402, in _rebuild
pickle_dump(fontManager, _fmcache)
File "C:\Python34\Lib\site-packages\matplotlib\font_manager.py", line 952, in pickle_dump
with open(filename, 'wb') as fh:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\KARTHIK KC\\.matplotlib\\fontList.py3k.cache'