gpt4 book ai didi

python - 无法导入matplotlib.pyplot,与字体相关的IOError

转载 作者:太空宇宙 更新时间:2023-11-03 13:42:52 24 4
gpt4 key购买 nike

我最近安装了 Python 的 Anaconda 发行版。当我尝试导入 matplotlib.pyplot 时,我收到“权限被拒绝”错误,因为字体管理器试图访问我计算机上的一种字体。

Python 2.7.8 |Anaconda 2.1.0 (x86_64)| (default, Aug 21 2014, 15:21:46) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org

>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.py", line 27, in <module>
import matplotlib.colorbar
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/colorbar.py", line 34, in <module>
import matplotlib.collections as collections
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 56, in <module>
import matplotlib.textpath as textpath
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/textpath.py", line 19, in <module>
import matplotlib.font_manager as font_manager
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1412, in <module>
_rebuild()
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1397, in _rebuild
fontManager = FontManager()
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1052, in __init__
self.ttflist = createFontList(self.ttffiles)
File "/Users/lck/anaconda/lib/python2.7/site-packages/matplotlib/font_manager.py", line 579, in createFontList
font = ft2font.FT2Font(fpath)
IOError: [Errno 13] Permission denied: u'/Library/Fonts/Finale Lyrics Italic.ttf'

我怎样才能让 matplotlib.pyplot 加载而不是在这个“权限被拒绝”字体错误时停止?我不需要任何特定的字体(例如,我不需要使用“Finale Lyrics Italics”——任何字体都可以)。任何想法将不胜感激!

最佳答案

我在 Linux Mint 17.2 中遇到了同样的问题。我在我的终端中这样做:sudo chmod 644/我的字体路径/*

对你来说,试试:sudo chmod 644/Library/Fonts/Finale/*

可以在此处找到更多信息 http://ubuntuforums.org/showthread.php?t=1976037

关于python - 无法导入matplotlib.pyplot,与字体相关的IOError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26895317/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com