我正在尝试在服务器上运行一个简单的脚本来测试matplolib。脚本很简单:
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt # no error here, it works
plt.figure(1).show()
但是,无法执行它,并且出现此错误: 老实说,我没什么主意了
Traceback (most recent call last):
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/font_manager.py", line 1459, in <module>
fontManager = json_load(_fmcache)
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/font_manager.py", line 986, in json_load
return json.load(fh, object_hook=_json_decode)
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/json/__init__.py", line 268, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/json/__init__.py", line 332, in loads
return cls(**kw).decode(s)
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/font_manager.py", line 977, in json_dump
json.dump(data, fh, cls=JSONEncoder, indent=2)
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/json/__init__.py", line 179, in dump
fp.write(chunk)
OSError: [Errno 28] No space left on device
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test2.py", line 3, in <module>
import matplotlib.pyplot as plt # no error, it works
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/pyplot.py", line 31, in <module>
import matplotlib.colorbar
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/colorbar.py", line 36, in <module>
import matplotlib.contour as contour
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/contour.py", line 20, in <module>
import matplotlib.font_manager as font_manager
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/font_manager.py", line 1469, in <module>
_rebuild()
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/font_manager.py", line 1454, in _rebuild
json_dump(fontManager, _fmcache)
File "/share/CACHEDEV1_DATA/.qpkg/Python3/python3/lib/python3.5/site-packages/matplotlib/font_manager.py", line 979, in json_dump
warnings.warn('Could not save font_manager cache ', e)
TypeError: category must be a Warning subclass, not 'OSError'