我最近将我的 Ubuntu 更新到 18.04,现在在使用 Python (2.7) 时,我无法再导入 matplotlib。导入时出错:
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/.local/lib/python2.7/site-packages/matplotlib/__init__.py", line 131, in <module>
from matplotlib.rcsetup import defaultParams, validate_backend, cycler
File "~/.local/lib/python2.7/site-packages/matplotlib/rcsetup.py", line 29, in <module>
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
File "~/.local/lib/python2.7/site-packages/matplotlib/fontconfig_pattern.py", line 28, in <module>
from backports.functools_lru_cache import lru_cache
ImportError: No module named functools_lru_cache
我通过安装 matplotlib
pip install --user matplotlib
和 matplotlib 一样,functools_lru_cache-module 安装在
~/.local/lib/python2.7/site-packages
我在这里想念什么?
我尝试按照此处的建议卸载并重新安装“functools_lru_cache”模块: python 2.7 functools_lru_cache does not import 尽管已安装 ,但这没有帮助。还是一样的错误。