在anaconda下的jupyter notebook(TensorFlow)环境下引用import matplotlib.pyplot as plt报错,但是如果是import matplotlib as plt就没有问题,找半天了不知道是啥原因。
而且报错提示好长,以下是报错提示:
FileNotFoundError Traceback (most recent call last)
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\font_manager.py in <module>()
1428 try:
-> 1429 fontManager = pickle_load(_fmcache)
1430 if (not hasattr(fontManager, '_version') or
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\font_manager.py in pickle_load(filename)
964 """
--> 965 with open(filename, 'rb') as fh:
966 data = pickle.load(fh)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\ASUS\\.matplotlib\\fontList.py3k.cache'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-1-eff513f636fd> in <module>()
----> 1 import matplotlib.pyplot as plt
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\pyplot.py in <module>()
27 from cycler import cycler
28 import matplotlib
---> 29 import matplotlib.colorbar
30 from matplotlib import style
31 from matplotlib import _pylab_helpers, interactive
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\colorbar.py in <module>()
34 import matplotlib.collections as collections
35 import matplotlib.colors as colors
---> 36 import matplotlib.contour as contour
37 import matplotlib.cm as cm
38 import matplotlib.gridspec as gridspec
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\contour.py in <module>()
20 import matplotlib.colors as colors
21 import matplotlib.collections as mcoll
---> 22 import matplotlib.font_manager as font_manager
23 import matplotlib.text as text
24 import matplotlib.cbook as cbook
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\font_manager.py in <module>()
1437 raise
1438 except:
-> 1439 _rebuild()
1440 else:
1441 _rebuild()
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\font_manager.py in _rebuild()
1416 global fontManager
1417
-> 1418 fontManager = FontManager()
1419
1420 if _fmcache:
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\font_manager.py in __init__(self, size, weight)
1051 # Load TrueType fonts and create font dictionary.
1052
-> 1053 self.ttffiles = findSystemFonts(paths) + findSystemFonts()
1054 self.defaultFamily = {
1055 'ttf': 'DejaVu Sans',
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\font_manager.py in findSystemFonts(fontpaths, fontext)
323 fontpaths = [fontdir]
324 # now get all installed fonts directly...
--> 325 for f in win32InstalledFonts(fontdir):
326 base, ext = os.path.splitext(f)
327 if len(ext)>1 and ext[1:].lower() in fontexts:
~\anaconda3\envs\tensorflow\lib\site-packages\matplotlib\font_manager.py in win32InstalledFonts(directory, fontext)
239 if not os.path.dirname(direc):
240 direc = os.path.join(directory, direc)
--> 241 direc = os.path.abspath(direc).lower()
242 if os.path.splitext(direc)[1][1:] in fontext:
243 items[direc] = 1
~\anaconda3\envs\tensorflow\lib\ntpath.py in abspath(path)
533 if path: # Empty path must return current working directory.
534 try:
--> 535 path = _getfullpathname(path)
536 except OSError:
537 pass # Bad path - return unchanged.
ValueError: _getfullpathname: embedded null character
请各位帮忙看看咋改,好像它这个报错还不止一个错误