import matplotlib.pyplot as q
a=[1,4,9,10,50]
q.plot(a)
q.show()
代码如上,别人试跑了一下,没问题,我又脸黑了
按照网上的回答,将matplotlib目录下的font_manager.py第231的改为
direc = direc.split('\0',1)[0] 也不可以
报错如下
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\site-packages\matplotlib\font_manager.py", line 1429, in <module>
fontManager = pickle_load(_fmcache)
File "C:\Program Files\Python35\lib\site-packages\matplotlib\font_manager.py", line 965, in pickle_load
with open(filename, 'rb') as fh:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Administrator.MS-20170416RCDC\\.matplotlib\\fontList.py3k.cache'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Sublime Text 3\py\game_functions.py", line 1, in <module>
import matplotlib.pyplot as q
File "C:\Program Files\Python35\lib\site-packages\matplotlib\pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "C:\Program Files\Python35\lib\site-packages\matplotlib\colorbar.py", line 36, in <module>
import matplotlib.contour as contour
File "C:\Program Files\Python35\lib\site-packages\matplotlib\contour.py", line 22, in <module>
import matplotlib.font_manager as font_manager
File "C:\Program Files\Python35\lib\site-packages\matplotlib\font_manager.py", line 1439, in <module>
_rebuild()
File "C:\Program Files\Python35\lib\site-packages\matplotlib\font_manager.py", line 1418, in _rebuild
fontManager = FontManager()
File "C:\Program Files\Python35\lib\site-packages\matplotlib\font_manager.py", line 1053, in __init__
self.ttffiles = findSystemFonts(paths) + findSystemFonts()
File "C:\Program Files\Python35\lib\site-packages\matplotlib\font_manager.py", line 325, in findSystemFonts
for f in win32InstalledFonts(fontdir):
File "C:\Program Files\Python35\lib\site-packages\matplotlib\font_manager.py", line 241, in win32InstalledFonts
direc = os.path.abspath(direc).lower()
File "C:\Program Files\Python35\lib\ntpath.py", line 535, in abspath
path = _getfullpathname(path)
ValueError: _getfullpathname: embedded null character
[Finished in 0.4s with exit code 1]
[shell_cmd: python -u "C:\Program Files (x86)\Sublime Text 3\py\game_functions.py"]
[dir: C:\Program Files (x86)\Sublime Text 3\py]
[path: C:\Program Files\Python35\Scripts\;C:\Program Files\Python35\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\C:\Program Files (x86)\Sublime Text 3\sublime_text.exe;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Python34\Scripts;]