简体   繁体   English

如何为 Ubuntu 安装 Tkinter?

[英]How do I install Tkinter for Ubuntu?

I recently installed Ubuntu as my operating system.我最近安装了 Ubuntu 作为我的操作系统。 I tried installing some python modules;我尝试安装一些 python 模块; it is giving an error.它给出了一个错误。 I am running the command sudo apt install python3-tk and the error is:我正在运行命令sudo apt install python3-tk ,错误是:

E: Malformed entry 1 in list file /etc/apt/sources.list.d/sublime-text.list (Suite)
E: The list of sources could not be read.
E: Malformed entry 1 in list file /etc/apt/sources.list.d/sublime-text.list (Suite)
E: The list of sources could not be read.

If you could help, thank you.如果你能帮忙,谢谢。

There is a slight modification required in the command you used.您使用的命令需要稍作修改。 Can you try,你能试一下吗,

sudo apt-get install python3.5-tk

instead?反而?


Try sudo apt-get install -qq python-tk试试sudo apt-get install -qq python-tk

It worked in my case.它在我的情况下有效。

For Python 2.7, do对于 Python 2.7,请执行

sudo apt-get install python-tk

For Python 3+, do对于 Python 3+,请执行

sudo apt-get install python3 python3-tk

or if you want to remain in Python 2.7, try或者,如果您想继续使用 Python 2.7,请尝试

sudo apt-get install python python-tk

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM