matplotlib crashing Python

后端 未结 5 1478
不思量自难忘°
不思量自难忘° 2021-01-13 16:21

I\'m new to Python and matplotlib. A simple script I wrote is crashing and I was able to reproduce the crash with the following code:

import matplotlib.pyplo         


        
5条回答
  •  佛祖请我去吃肉
    2021-01-13 17:13

    I was having this issue, I thought it was some line in my code causing the bug, but in fact the very act of importing matplotlib.pyplot was killing my program. I solved it by first running it in verbose mode:

    python -v [programname].py

    This shows the last action the importer does before crashing. For me, the last line of this was:

    import 'PyQt5' # <_frozen_importlib_external.SourceFileLoader object at 0x000001F8EC9C0908>

    This suggested to me that the dependent library PyQt5 was causing issues, so I ran pip install PyQt5, and magically everything started working.

提交回复
热议问题