python 2.7 functools_lru_cache does not import although installed

前端 未结 14 1712
星月不相逢
星月不相逢 2020-12-05 17:21

When I try to import matplotlib I get an error

Traceback (most recent call last):
  File \"\", line 1, in 
  File \"/usr/local/lib         


        
相关标签:
14条回答
  • 2020-12-05 18:05

    I had the same problem but I fixed it.

    Uninstall first

    pip uninstall backports.functools_lru_cache
    

    and then re-install it.

    pip install backports.functools_lru_cache
    

    Now I'm able to import matplotlib. Hope this helps.

    0 讨论(0)
  • 2020-12-05 18:07

    I had same issue, re-installation of backports.functools_lru_cache resolved the issue

    0 讨论(0)
  • 2020-12-05 18:09

    The pip command was actually the pip3, and the "ImportError" was happening when I used python (2.7).

    pip2 uninstall backports.functools_lru_cache
    

    then,

    pip2 install backports.functools_lru_cache
    

    fixed my problem.

    0 讨论(0)
  • 2020-12-05 18:11

    If someone is still having that problem and reinstalling backports.functools_lru_cache do not work in his case, as it was in my case, then probably installing older version of matplotlib would work. For example:

    pip install matplotlib==2.0.2
    

    Problem occurred for version 2.2.0, I switched to 2.0.2 and it is working now. I did not check other versions.

    0 讨论(0)
  • 2020-12-05 18:17

    You are using pyhton 2. try to use pip2 instead:

    • pip2 uninstall matplotlib
    • sudo apt-get autoremove python-matplotlib
    • sudo apt-get install python-matplotlib
    0 讨论(0)
  • 2020-12-05 18:19

    Also meet this issue on Ubuntu 16. Uninstall & reinstall not work for me.

    My solution is reinstall from apt.

    pip uninstall matplotlib
    sudo apt-get autoremove python-matplotlib
    sudo apt-get install python-matplotlib
    
    0 讨论(0)
提交回复
热议问题