我想在 python 2.7.9 中安装 Tkinter,我尝试了 sudo apt-get update sudo apt-get install python-tk,我甚至尝试升级 python 以安装 Tkinter,但也没有用。每次我尝试安装时都会出现这种情况
sudo apt-get install python-tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-tk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-tk' has no installation candidate
答案1
你正在运行 2016 年达到 EOL 的 Ubuntu 版本,即 Ubuntu 15.04。关注本指南升级到受支持的 Ubuntu 版本,或者直接全新安装最新受支持的版本 16.04 (LTS) 或 17.10。然后尝试:
sudo apt update
sudo apt install python-tk