嗨,您必须在我的情况下找到此文件:font_manager.py:C:\ Users \ gustavo \ Anaconda3 \ Lib \ site-packages \ matplotlib \ font_manager.py
和查找def win32InstalledFonts(directory = None,fontext ='ttf')并替换为:
def win32InstalledFonts(directory = None,fontext ='ttf'):“”“在指定的字体目录中搜索字体,如果未提供,则使用系统目录。默认情况下,返回TrueType字体文件名列表;如果返回,则返回AFM字体fontext =='afm'。“”“
from six.moves import winreg
if directory is None:
directory = win32FontDirectory()
fontext = get_fontext_synonyms(fontext)
key, items = None, {}
for fontdir in MSFontDirectories:
try:
local = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, fontdir)
except OSError:
continue
if not local:
return list_fonts(directory, fontext)
try:
for j in range(winreg.QueryInfoKey(local)[1]):
try:
key, direc, any = winreg.EnumValue(local, j)
if not is_string_like(direc):
continue
if not os.path.dirname(direc):
direc = os.path.join(directory, direc)
direc = direc.split('\0', 1)[0]
if os.path.splitext(direc)[1][1:] in fontext:
items[direc] = 1
except EnvironmentError:
continue
except WindowsError:
continue
except MemoryError:
continue
return list(six.iterkeys(items))
finally:
winreg.CloseKey(local)
return None
~/.cache/matplotlib
然后重试。这可能是权限问题-不应每次都建立缓存