我无法在 python2.7 上安装 python-tk

我无法在 python2.7 上安装 python-tk

我是 Ubuntu Mate 16.04 用户。我想运行这个程序。我必须使用 python2.7 来运行该程序。然后我输入

python2 train_and_test.py

在终端上。然后,显示一个错误。

ImportError:没有名为 _tkinter 的模块,请安装 python-tk 包

因此我尝试安装 python-tk。我输入

sudo apt-get install python3-tk

安装成功。接下来,我输入

sudo apt-get -y install python-tk

但安装失败。

Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  tix python-tk-dbg
The following NEW packages will be installed:
  python-tk
0 upgraded, 1 newly installed, 0 to remove and 283 not upgraded.
Need to get 26.3 kB of archives.
After this operation, 95.2 kB of additional disk space will be used.
Err:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 python-tk amd64 2.7.12-1~16.04
Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python-stdlib-extensions/python-tk_2.7.12-1~16.04_amd64.deb
Something wicked happened resolving 'archive.ubuntu.com:http' (-5 - No address associated with hostname)

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

我已经更新了apt-get。我应该如何安装python-tk

相关内容