通过输入以下命令安装python3-tk时出现以下错误:
apt-get install python3-tk
Need to get 34.4 kB of archives.
After this operation, 150 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
python3-tk
Install these packages without verification? [y/N] y
Err http://us.archive.ubuntu.com/ubuntu/ wily/main python3-tk amd64 3.4.3-4
404 Not Found [IP: 91.189.91.26 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/python3-stdlib-extensions/python3-tk_3.4.3-4_amd64.deb 404 Not Found [IP: 91.189.91.26 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
I tried to run apt-get update and tried with --fix-missing but of no use. Can anybody help me figure out the way to solve this or provide alternate method to download tkinter for python3 ?
答案 0 :(得分:0)
您无需单独安装tkinter
。只需使用from tkinter import *
答案 1 :(得分:0)
如果您使用的是Ubuntu,请先尝试添加Deadsnakes ppa:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
然后,根据similar question的答案,具体取决于您所使用的python版本和项目配置:
为Python3.x.x安装tkinter:
sudo apt-get install python3-tk
对于将Python 3.5作为“系统” python的Python 3.6虚拟环境:
sudo apt-get install python3.6-tk
“通常,如果一个虚拟环境使用的Python版本与基本计算机版本不同,则必须为虚拟环境中使用的python版本安装tk”:
sudo apt install python3.x-tk
“ 3.x将与虚拟环境的版本匹配的地方。”