链接: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. 如何定位jdk中的native方法源码?

    前提条件:已下载openjdk的源码. 以System类的arraycopy为例: 1. 根据关键字定位文件:grep -rn '"arraycopy"' ./openjdk关键字 ...

  2. Python3+ssl实现加密通信

    一.说明 1. python标准库ssl可实现加密通信 2. ssl库底层使用openssl,做了面向对像化改造和简化,但还是可以明显看出openssl的痕迹 3. 本文先给出python实现的soc ...

  3. MySQL数据库安装与配置鸡汤

    目录 一.概述 二.MySQL安装 三.安装成功验证 四.NavicatforMySQL下载及使用 一.概述 MySQL版本:5.7.17 下载地址:http://rj.baidu.com/soft/ ...

  4. shiro过滤器解释类

    anon -- org.apache.shiro.web.filter.authc.AnonymousFilter authc -- org.apache.shiro.web.filter.authc ...

  5. php读取excel时间42930转化为时间然后正则验证时间是否通过

    excel时间 function exceltimtetophp($days,$time=false) { if(is_numeric($days)) { //凯撒日计数,要把我们运用的从1970年开 ...

  6. ID基本操作(标尺,参考线,网格)5.11

    参考线:标尺参考线,分栏参考线,出血参考线.在创建参考线之前确保标尺和参考线都可见.并且选中正确的跨页和页面作为目标, “版面”“创建参考线”可以输入数值创建参考线. 跨页参考线的创建:拖动参考线时鼠 ...

  7. centos 安装 composer

    1 安装 composer       curl -sS https://getcomposer.org/installer | php           2 添加到环境变量       mv co ...

  8. Five Great .NET Framework 4.5 Features (五大特性)

    [译].Net 4.5 的五项强大新特性   本文原文:Five Great .NET Framework 4.5 Features译者:冰河魔法师 目录 介绍 特性一:async和await 特性二 ...

  9. [CodeForces332E]Binary Key

    Problem 题目给出一个加密前的字符串长度为p和加密后的字符串长度为s,让你求一个长度为K字典序最小的密钥. 密钥是循环的,第i位为1表示加密前的第i为是有用的否则是没用的. Solution 首 ...

  10. 正则:img的url,width,height 和 a标签的url以及替换

    代码:// 内容:$detail['content'] //img的url,width,height $img = array(); $matches = array(); $regeImg = '/ ...