ImportError: cannot import name cbook

前端 未结 5 1089
星月不相逢
星月不相逢 2020-12-07 00:39
>>> import matplotlib
Traceback (most recent call last):
  File \"\", line 1, in 
  File \"/usr/local/lib/python2.7/dist-packages         


        
5条回答
  •  独厮守ぢ
    2020-12-07 00:56

    just sharing my experience, I was trying to run Python code (2.7) making use of matplotlib. The code is running inside a docker container based on a Debian 10 image.

    In the end I based the solution on the answers here, but there was a small caveat. I had to do the actions in the following order:

    1. Install the rest of the requirements
    2. Install matplotlib (no need to specify a version in my case, 2.2.5 was installed by pip)
    3. Install arrow
    4. Uninstall backports.functools_lru_cache
    5. Install backports.functools_lru_cache version 1.2.1

    The code on the dockerfile is as it follows:

    RUN pip2 install -r requirements.txt
    RUN pip2 install matplotlib
    RUN pip2 install arrow
    RUN pip2 uninstall -y backports.functools_lru_cache
    RUN pip2 install backports.functools_lru_cache==1.2.1
    

    You can find the whole project on github: https://github.com/n3if/irassh.git

提交回复
热议问题