How to install python-tk in my docker image

拥有回忆 提交于 2019-12-06 02:46:24

Use import Tkinter. It should not be required via pip. It's built into python2.7 (Assuming you are using python2.7 since this post is tagged with it. If you are using 3 then it's a different solution and what the people in comments are referencing.)

https://docs.python.org/2/library/tkinter.html#module-Tkinter

It is probably not a problem with the package not being installed but rather not running because of lack of display.

For convenience I'm pasting the code how to do that:

docker run -ti -e DISPLAY=$DISPLAY blah-image blah-command

Extracted from here: Python Tkinter in Docker .TclError: couldn't connect to display

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!