import matplotlib.pyplot hangs

后端 未结 3 1605
长发绾君心
长发绾君心 2020-12-04 15:26

I\'m trying to get matplotlib up and running on OS X 10.8.4. I\'ve installed matplotlib and the dependencies (libping, freetype, numpy, scipy). I am able to import matplotli

相关标签:
3条回答
  • 2020-12-04 16:10

    I was having the same problem on Linux.

    Turned out matplotlib was having some issues figuring out the GUI backend to use.

    Explicitly saying it to use Tkinter background - which it does by default, using the following command resolved the issue:

    %matplotlib tk
    

    This followed by import

    import matplotlib.pyplot as plt
    

    worked as expected.

    0 讨论(0)
  • 2020-12-04 16:15

    You can fix the problem on Mac OS X Mavericks and Yosemite by doing the following:

    cd ~/.matplotlib/
    fc-list  # Should take a couple minutes.
    

    After fc-list finishes running you will be able to import the package using import matplotlib.pyplot as plt. This is the github issue with the solution. It seems the bug is related to the font cache.

    0 讨论(0)
  • 2020-12-04 16:17

    I figured out what was happening. Hopefully the solution is useful to others. In the /usr/X11/lib folder there was a symbolic link for the directory that was pointing back to itself. This appears to have created an infinite loop. When I removed the link, the import worked.

    0 讨论(0)
提交回复
热议问题