当我在 docker 映像中运行 python 脚本时出现此错误
ImportError: No module named _tkinter, please install the python-tk package
所以我尝试了“pip install python-tk”
root@43d2222b15c8:/tf_files# pip install python-tk
Collecting python-tk
Could not find a version that satisfies the requirement python-tk (from versions: )
No matching distribution found for python-tk
但这并不能解决我的问题。
您能告诉我如何解决我的问题吗?
谢谢。
Use import Tkinter
。不应通过 pip 要求它。它内置于 python2.7 中(假设您使用的是 python2.7,因为这篇文章是用它标记的。如果您使用的是 3,那么这是一个不同的解决方案以及评论中的人们所引用的内容。)
https://docs.python.org/2/library/tkinter.html#module-Tkinter https://docs.python.org/2/library/tkinter.html#module-Tkinter
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)