Generating a PNG with matplotlib when DISPLAY is undefined

前端 未结 12 1260
感动是毒
感动是毒 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 03:02

    One other thing to check is whether your current user is authorised to connect to the X display. In my case, root was not allowed to do that and matplotlib was complaining with the same error.

    user@debian:~$ xauth list         
    debian/unix:10  MIT-MAGIC-COOKIE-1  ae921efd0026c6fc9d62a8963acdcca0
    root@debian:~# xauth add debian/unix:10  MIT-MAGIC-COOKIE-1 ae921efd0026c6fc9d62a8963acdcca0
    root@debian:~# xterm
    

    source: http://www.debian-administration.org/articles/494 https://debian-administration.org/article/494/Getting_X11_forwarding_through_ssh_working_after_running_su

提交回复
热议问题