Python matplotlib - ImportError: functools_lru_cache라는 모듈이 없습니다.

Python matplotlib - ImportError: functools_lru_cache라는 모듈이 없습니다.

오류 없이 완료된 matplotlibPython을 사용하여 설치했습니다 . pip하지만 가져오려고 하면 다음 오류가 발생합니다.

import matplotlib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/rishabh/.local/lib/python2.7/site-packages/matplotlib/__init__.py", line 131, in <module>
    from matplotlib.rcsetup import defaultParams, validate_backend, cycler
  File "/home/rishabh/.local/lib/python2.7/site-packages/matplotlib/rcsetup.py", line 29, in <module>
    from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
  File "/home/rishabh/.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

답변1

이것을 시도해 보세요. 오늘 아침에도 같은 문제가 발생했습니다.

sudo apt-get install python-matplotlib

또한 몇 가지 모듈을 설치한 후 조금 후에 python3.7을 사용하고 있습니다. 나는 달렸다.

pip3 install matplotlib

이제 matplotlib을 가져올 수 있습니다.

답변2

먼저 제거

pip uninstall backports.functools_lru_cache

그런 다음 다시 설치하세요.

pip install backports.functools_lru_cache

설명한 것처럼이 답변에서.

관련 정보