Lo instalé matplotlib
para Python pip
y se completó sin errores. Sin embargo, aparece este error cuando intento importarlo:
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
Respuesta1
prueba esto tuve el mismo problema esta mañana
sudo apt-get install python-matplotlib
También estoy usando python3.7 un poco más tarde, después de instalar algunos módulos. Corrí.
pip3 install matplotlib
Ahora puedo importar matplotlib.
Respuesta2
Desinstalar primero
pip uninstall backports.functools_lru_cache
y luego reinstalarlo
pip install backports.functools_lru_cache
como se describeen esta respuesta.