python3.6安装tkinter_在Ubuntu上的python3.6中安装tkinter
我遇到了一个与你类似的问题,我将详细说明我是如何解决的。
在Ubuntu16.04LTS上,我有Python3.5.2和Python2.7.12,但是我想尝试Python3.6(例如,出于各种原因,比如this one)。所以我依靠这个post:sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
当我试图使用tkinter运行模块时,收到以下错误消息:Traceback (most recent call last):
File "/usr/lib/python3.6/tkinter/__init__.py", line 37, in
import _tkinter
ModuleNotFoundError: No module named '_tkinter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "bill.py", line 3, in
from tkinter import Canvas, Label, Tk, StringVar, Button, LEFT
File "/usr/lib/python3.6/tkinter/__init__.py", line 39, in
raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package
我试图安装tkinter,正如上面的消息所问:sudo apt-get install python3-tk
[sudo] password for begueradj:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-tk is already the newest version (3.5.1-1).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
显然,我仍然不能在Python3.6中使用tkinter。如何解决这个问题?
我的第一次盲目尝试没有成功:sudo apt-get install python36-tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python36-tk
第二个工作:sudo apt-get install python3.6-tk
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
tix python3.6-tk-dbg
The following NEW packages will be installed:
python3.6-tk
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 74.6 kB of archives.
After this operation, 165 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial/main amd64 python3.6-tk amd64 3.6.5-1+xenial1 [74.6 kB]
Fetched 74.6 kB in 0s (301 kB/s)
Selecting previously unselected package python3.6-tk:amd64.
(Reading database ... 324106 files and directories currently installed.)
Preparing to unpack .../python3.6-tk_3.6.5-1+xenial1_amd64.deb ...
Unpacking python3.6-tk:amd64 (3.6.5-1+xenial1) ...
Setting up python3.6-tk:amd64 (3.6.5-1+xenial1) ...
这解决了我的问题:~/python3.6
Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>
python3.6安装tkinter_在Ubuntu上的python3.6中安装tkinter相关推荐
- ubuntu上python编辑器_Ubuntu中安装python编辑器Ulipad
由于在Windows中使用Ulipad一段时间了,尤其对于Python代码的编辑功能,我觉得目前还没有一款别的编辑器能与之媲美(当然Ulipad也有美中不足的地方).下面介绍一下在Linux下Ulip ...
- 在Ubuntu上用python3安装caffe(仅CPU)
在Ubuntu上用python3安装caffe(仅CPU) 现在网上安装caffe的版本基本上都是基于python 2.7的,本教程旨在用anaconda 3安装caffe cpu,其过程非常艰辛,连 ...
- 在windows上的git bash中安装tree 和 linux tree命令使用
在windows上的git bash中安装tree 和 linux tree命令使用 文章目录: 1 在windows上的git bash中安装tree 1.1 下载windows版本的tree 1. ...
- ESX/ESXi 主机上的每个插槽中安装了多少内存
要确定在 ESX/ESXi 主机上的每个插槽中安装了多少内存,请执行以下操作: 1. 启动ssh服务 2. 登陆esxi主机查看 使用 SSH 客户端登录主机,以 root 用户身份运行以下命令之一: ...
- python安装没有pip选项_python-3.x – 在ubuntu上没有pip的python安装
我需要在一个自定义Docker容器中安装一个Python包,我正在使用官方的'ubuntu'Docker映像构建,所以我想最小化它使用的空间. Python3安装正常并运行,但由于某种原因,不包括pi ...
- ubuntu python安装pip_在 Ubuntu 上安装 pip的方法
1.为 Python 2 安装 pip 首先,确保已经安装了 Python 2. 在 Ubuntu 上,可以使用以下命令进行验证 python2 --version 如果没有错误并且显示了 Pytho ...
- linux安装vi 插件,Ubuntu上Vim安装NERDTree插件的详细操作步骤
NERDTree是Vim的文件系统浏览器,使用此插件,用户可以直观地浏览复杂的目录层次结构,快速打开文件以进行读取或编辑,以及执行基本的文件系统操作.NERDTree源码在https://github ...
- Python在Linux实现代码特效,关于在Linux系统上的Ubuntu上基于python3、shell语言代码的实现...
首先打开执行终端,然后进入路径(执行文件的目录): 1.python3语言代码的实现步骤: 1>python3 xxx.py(一步实现) 2.shell语言代码的实现步骤: 1>获取属主的 ...
- protobuf2和3同时安装_在 Ubuntu 上安装 Protobuf 3 的教程详解
什么时候需要安装 如果使用 protoc 命令,遇到 Protoc not found,表示未安装.或者,执行时出现错误:This parser only recognizes "proto ...
最新文章
- 怎么计算z=x+y的概率密度_amp;@*!#+用西语到底该怎么说?
- html以及css的部分相关内容及运用
- PTA浙大版python程序设计题目集--第2章-2 计算分段函数[1] (10 分)
- 几个常见的Python面试题分享,帮你顺利求职
- android:制作 Nine-Patch 图片
- P2550 [AHOI2001]彩票摇奖(python3实现)
- Redisbook学习笔记(1)字典(2)
- python小玩意——敏感词汇检测
- 【spring】自定义AOP切面
- Adobe Reader 已停止工作
- 谷歌SEO之如何选择关键词(2021更新教程)
- php验证是否是jwt,php实现JWT认证的方法 JWT验证使用流程
- Linux Ubuntu16.04 Python3.5.2 Cuda10.1 TITAN XP安装fastai v1
- kali下安装VMware
- 文字,字体,图像,列表
- 排列组合问题 “n个球放入m个盒子(8种)”
- java数据结构和算法 北风 下载_Java] 北风Java20集+44集版数据结构算法基础教程
- 哲学家就餐问题python实现
- 实现一个地铁线路站点
- 华为实验24-vRRP基本配置