无法导入matplotlib.pyplot并生成EOFError

时间:2017-03-17 02:47:14

标签: python python-3.x matplotlib eoferror

我正在启动python,我遇到了模块matplotlib。 我在导入matplotlib.pyplot时遇到问题。 实际上,我知道这是一个非常着名的问题,但我不能以任何方式解决这个问题。

Python 2.7: Unable to import matplotlib.pyplot

对于上面的链接,这与我的错误不一样。

我现在有EOFError,让我烦恼。我尝试了很多东西。比如重新安装matplotlib,用conda install matplotlib安装,而不是用pip等。 我是否应该重新安装anaconda ..?

Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> import matplotlib.pyplot as plt
Traceback (most recent call last):
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1429, in <module>
    fontManager = pickle_load(_fmcache)
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 966, in pickle_load
    data = pickle.load(fh)
EOFError: Ran out of input

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 29, in <module>
    import matplotlib.colorbar
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\colorbar.py", line 36, in <module>
    import matplotlib.contour as contour
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\contour.py", line 22, in <module>
    import matplotlib.font_manager as font_manager
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1439, in <module>
    _rebuild()
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1418, in _rebuild
    fontManager = FontManager()
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 1053, in __init__
    self.ttffiles = findSystemFonts(paths) + findSystemFonts()
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 325, in findSystemFonts
    for f in win32InstalledFonts(fontdir):
  File "C:\Users\water\Anaconda3\lib\site-packages\matplotlib\font_manager.py", line 241, in win32InstalledFonts
    direc = os.path.abspath(direc).lower()
  File "C:\Users\water\Anaconda3\lib\ntpath.py", line 535, in abspath
    path = _getfullpathname(path)
ValueError: _getfullpathname: embedded null character

0 个答案:

没有答案