Generating a PNG with matplotlib when DISPLAY is undefined

前端 未结 12 1431
感动是毒
感动是毒 2020-11-22 02:51

I am trying to use networkx with Python. When I run this program it get this error. Is there anything missing?

#!/usr/bin/env python

import networkx as nx
i         


        
12条回答
  •  暖寄归人
    2020-11-22 02:59

    import matplotlib
    matplotlib.use('Agg')
    import matplotlib.pyplot as plt
    

    It works for me.

提交回复
热议问题