链接:https://www.zhihu.com/question/42162071/answer/95441732

安装tkinter

tkinter是由tcl和tk两个部分组成的,所以下载tkinter的时候,要下载tcl8.6.5和tk8.6.5两部分。下载完之后分别解压tar -zxvf tcl8.6.5-src.tar.gz,tar -zxvf tk8.6.5-src.tar.gz.解压完成之后先安装tcl:

  1. cd tcl8.6.5/unix
  2. ./configure
  3. make
  4. sudo make install
    接着再安装tk:

  5. cd tk8.6.5/unix

  6. ./configyre

  7. make

  8. sudo make install

如果第4步出现类似x11/xlib.h:没有那个文件或目录,还需要多一步,需要安装sudo apt-get install libx11.dev 然后接着继续第4步。

现在应该成功安装了。输入wish 回车 info tclversion 和puts $tk_version查看版本。

修改Setup.dist文件

进入到Python解压包的目录下,注意,不是安装Python的目录,而是解压的目录,一般而言就是下载Python目录下,之前我一直在安装目录下找Modules文件夹,死活找不到。

vim Modules/Setup.dist

修改如图所示:

<img data-rawheight="649" data-rawwidth="632" src="https://pic1.zhimg.com/50/678377635936dfad518a185e877301b8_hd.jpg" class="origin_image zh-lightbox-thumb" width="632" data-original="https://pic1.zhimg.com/678377635936dfad518a185e877301b8_r.jpg">

把箭头所指的行数前面的注释去掉,同时在第4个箭头处,修改tcl和tk的版本为刚才的安装版本,保持退出。

  • sudo apt-get install libreadline-dev这个必须安装,因为不安装,在Python交互中上下左右移动无法成功.

重新编译和安装Python3.5

接下来还需要重新编译和安装一遍Python,

sudo apt-get update
sudo apt-get upgrade

sudo apt-get install python3

重新建立到python3.5的软连接即可:

ortonwu@ubuntu:/usr/bin$ sudo rm -rf /usr/bin/python
ortonwu@ubuntu:/usr/bin$ sudo ln -s /usr/bin/python3.5 /usr/bin/python
ortonwu@ubuntu:/usr/bin$ sudo rm -rf /usr/bin/pip3
ortonwu@ubuntu:/usr/bin$ sudo ln -s /usr/bin/python3.5/pip3 /usr/bin/pip3
ortonwu@ubuntu:/usr/bin$ sudo rm -rf /usr/bin/python3
ortonwu@ubuntu:/usr/bin$ sudo ln -s /usr/bin/python3.5 /usr/bin/python3
在3.6后,pip3的使用方法

On Unix-like systems use:

python3.6 -m pip install [Package_to_install]

或来到Python3.5.2的源文件目录的

  1. ./configure
  2. make
  3. sudo make install

【转】在python3.5安装tkinter的更多相关文章

  1. python安装tkinter

    python2安装tkinter sudo apt-get install python-tk python3 安装tkinter sudo apt-get install python3-tk

  2. [No00004B]Windows 下面为Python3.5安装NoteBook

    python3.5安装NoteBook,网上搜了一下教程,几乎很多转帖,或者是2.x版本的,很少有直接可以用的.自己琢磨了一下午,终于搞定了,现在贴出来.希望大家以后转帖什么的都先测试一下,互联网时代 ...

  3. python3.4安装suds

    使用suds访问webservice十分方便 python3.x安装suds会报错“No module named client” 在stackoverflow上找到了替代方法,安装suds-jurk ...

  4. python3.7安装pylint

    python3.7安装pylint之"setuptools"版本错误 借鉴:错题集(已解决):pyinstaller报错ModuleNotFoundError: No module ...

  5. Python2.X和Python3.X中Tkinter模块的文件对话框、下拉列表的不同

    Python2.X和Python3.X文件对话框.下拉列表的不同 今天初次使用Python Tkinter来做了个简单的记事本程序.发现Python2.x和Python3.x的Tkinter模块的好多 ...

  6. boost python3依赖安装

    之前写过python dlib依赖的安装,当时是使用了系统默认的python2.7安装的boost.Python,如果自己编译好python3,想安装支持python3的boost.Python也是可 ...

  7. windows python3.7安装numpy问题的解决方法

    我的是win7的系统,去python官网下载python3.7安装 CMD  #打开命令窗口 pip install numpy #在cmd中输入 提示 需要c++14.0, 解决办法: 1, 进入h ...

  8. Python3 离线安装TensorFlow包

    Python3 离线安装TensorFlow包 1,下载包 官网地址:https://pypi.org/project/tensorflow/1.1.0rc2/#files 清华镜像:https:// ...

  9. linux --- 2.常用命令 , python3, django安装

    一.常用命令 1.常识命令 ① w      显示终端连接数 ②pwd    我在哪 ③whoami      我是谁 ④which 命令        找到命令的绝对路径 2.linux 命令行的组 ...

随机推荐

  1. 函数式编程语言(Fuction Program Language)

    一.什么是函数式编程语言 函数式编程语言(functional progarm language)一类程序设计语言,是一种非冯·诺伊曼式的程序设计语言.函数式语言主要成分是原始函数.定义函数和函数型. ...

  2. redis集群搭建教程(以3.2.2为例)

    redis从3.0版本开始支持集群,2.X版本主支持sentinel主从模式:所以要搭建集群务必下载3.0以上版本,本教程以3.2.2版本为例. redis集群最少要有3个主节点,最典型的是3主3从组 ...

  3. memory prefix il ir im in out 3 i

    1● il   2● ir 不 非 无 :使 ~ 成为:   3● im 4● in 不 非 无 :向内,进入  

  4. js如何将选中图片文件转换成Base64字符串?

    如何将input type="file"选中的文件转换成Base64的字符串呢? 1.首先了解一下为什么要把图片文件转换成Base64的字符串 在常规的web开发过程中,大部分上传 ...

  5. zabbix3.4.7之Zabbix_Trigger_Function详解

    Trigger函数 1.abschange 参数:直接忽略后边的参数 支持值类型:float.int.str.text.log 描述:返回最近获取到的值与之前值的差值的绝对值.对于字符串类型,0表示值 ...

  6. Cyclic Components CodeForces - 977E(DFS)

    Cyclic Components CodeForces - 977E You are given an undirected graph consisting of nn vertices and  ...

  7. Python之路-python基础一

    本章内容:       一.编程语言分类       二.python之变量介绍       三.python交互命令(input,print,getpass)       四.Python之循环控制 ...

  8. inode占用100%时硬盘无法写入文件故障处理

    故障现象: 分区无法写入文件. 故障分析: 执行df -h命令发现空间占用不到50%,执行df -hi,发现某分区IUse%值为99%,说明innode已经用完,应该是某些目录下存在大量的小文件导致. ...

  9. flask-admin fileadmin 上传文件,中文名的解决方案 重写部分secure_filename

    class upload_view(FileAdmin): def _save_form_files(self, directory, path, form): super() filename = ...

  10. ubuntu查看占用某端口的程序

    查看端口使用情况,使用netstat命令. 查看已经连接的服务端口(ESTABLISHED netstat -a 查看所有的服务端口(LISTEN,ESTABLISHED) netstat -ap 查 ...