ubuntu 16.04,已安装nvidia-docker,正在运行tensorflow容器,python 2.7
我想在容器内运行一个简单的python代码。如下图所示
from tkinter import *
master = Tk()
canvas_width = 80
canvas_height = 40
w = Canvas(master,
width=canvas_width,
height=canvas_height)
w.pack()
y = int(canvas_height / 2)
w.create_line(0, y, canvas_width, y, fill="#476042")
mainloop()
Run Code Online (Sandbox Code Playgroud)
但是当我运行这个时,这个错误来了
_tkinter.TclError:没有显示名称,也没有$ DISPLAY环境变量
并根据该站点https://github.com/moby/moby/issues/8838, 我将我的容器提交给了一个图像,然后使用-e标志再次运行它:
-e DISPLAY =:0.0
但是这里出现错误:
_tkinter.TclError:无法连接到显示器:0.0
我没有使用ssh登录容器。有人可以给我建议吗?