Debian 7 自带的python是2.7.3,要用最新的3.4版本怎么办?我们从官网下载压缩包自己编译。

一、安装编译用的包

 $ sudo apt-get install build-essential
$ sudo apt-get install libncurses5-dev libncursesw5-dev libreadline6-dev
$ sudo apt-get install libdb5.-dev libgdbm-dev libsqlite3-dev libssl-dev
$ sudo apt-get install libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev

二、下载压缩包

wget -c https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz

三、编译安装

 $ cd download/
$ tar -zxf Python-3.4..tgz
$ cd Python-3.4.
$ ./configure --prefix=/opt/python-3.4.
$ make
$ sudo make install
$ cd download/
$ sudo rm -rf Python-3.4. #删除解压目录

安装好后把 python3 添加到PATH里,打开~/.bashrc 文件,在最后添加:

export PATH=$PATH:/opt/python-3.4./bin

保存后:

source .bashrc

在终端里输入 python3,可以看到现在的版本是3.4.1。

$ python3
Python 3.4. (default, Aug , ::)
[GCC 4.6.] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

2015.01.09 更新:

在make时出现这个提示:

# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
sed -e "s,@EXENAME@,/opt/python-3.4.2/bin/python3.4m," < ./Misc/python-config.in >python-config.py
# Replace makefile compat. variable references with shell script compat. ones; ->
sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
# On Darwin, always use the python version of the script, the shell
# version doesn't use the compiler customizations that are provided
# in python (_osx_support.py).
if test `uname -s` = Darwin; then \
cp python-config.py python-config; \
fi

按提示操作:

$ sed -e "s,@EXENAME@,/opt/python-3.4.2/bin/python3.4m," < ./Misc/python-config.in >python-config.py
$ sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config

再make:

$ make

最后:

sudo make install

在编译安装python3.4.2时有这个提示:

INFO: Can't locate Tcl/Tk libs and/or headers

Python build finished successfully!
The necessary bits to build these optional modules were not found:
_tkinter
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

解决办法:

sudo apt-get install python-tk tcl tk tcl-dev tk-dev 

--End--

Debian 7 安装 Python3.4的更多相关文章

  1. 在阿里云CentOS服务器上安装Python3.7并设置为默认Python

    1.引言 Linux操作系统自带一个python2.7,没有python3,在开发的时候非常不便,因此需要安装一个python3,并且将python3设置系统默认python,同时还不能影响那些Lin ...

  2. Jenkins(2)docker容器中安装python3

    前言 使用docker安装jenkins环境,jenkins构建的workspace目录默认是在容器里面构建的,如果我们想执行python3的代码,需进容器内部安装python3的环境. 进jenki ...

  3. jenkins容器内安装python3

    前言 很多小伙伴可能在考虑 jenkins 拉取了 github 上的代码后,发现还越少 python3 环境,那能怎么办呢? 咨询了一位运维朋友给我的答案是,将 python3 挂载到容器工作目录上 ...

  4. 在 Debian 上安装 SQL Server vNext CTP1

    微软在开源 .NET Framework 之后,相继推出了跨平台的编辑器 Visual Studio Code,跨平台的 SQL Server 数据库 SQL Server vNext,Visual ...

  5. centos6安装python3.4和pip3

    在安装了epel源的情况下,直接yum就可以安装python3.4 yum install python34 -ypython3 --version 没有自带pip3,从官网安装 wget --no- ...

  6. 在CentOS6.8上面安装Python3.5

    以前每次装Linux,升级Python,都会一堆问题,然后Google,本来想着记录一下,结果问题太多了,也就记不住了,这次特地记了下来. 在CentOS6.8上面安装Python3.5我的系统是Ce ...

  7. python3.5学习笔记:linux6.4 安装python3 pip setuptools

    前言: python3应该是python的趋势所在,当然目前争议也比较大,这篇随笔的主要目的是记录在linux6.4下搭建python3环境的过程 以及碰到的问题和解决过程. 另外,如果本机安装了py ...

  8. 在Ubuntu中安装Python3

    首先,通过命令行安装Python3.2,只需要在终端中通过命令行安装即可: sudo apt-get install python3   一路yes. 因为Ubuntu很多底层采用的是Python2. ...

  9. python环境搭建-在Windows上安装python3.5.2

    在Windows上安装Python3.5.2 首先,根据你的Windows版本(64位还是32位)从Python的官方网站下载Python 3.5.2对应的64位安装程序或32位安装程序(网速慢的同学 ...

随机推荐

  1. Orchard源码分析(1):插件式的支持——模块和主题

    在Orchard,模块和主题都是可以插拔式的,在源码处理时,用类型(参考:DefaultExtensionTypes)区分,都没太大的本质区别,以下都称做模块. 插件的支持,实现分以下几步: 搜集模块 ...

  2. 解读MMS(Microsoft Media Server)协议

    下面是一次截取的MMS协议开始帧 部分(十六进制): 01000000cefa0bb0c00000004d4d5320 18000000000000000000000000000000 1600000 ...

  3. ubuntu java jdk安装及环境变量设置

    1.下载jdk1.7.0_79 (32位操作系统)jdk-7u79-linux-i586.tar.gz (64位操作系统)jdk-7u79-linux-x64.tar.gz http://www.or ...

  4. Linux下搭建jdk

    1.上oracle下载jdk-8u73-linux-x64.gz文件(其他版本的也可以,不过本教程以.gz格式为准,其他格式没有尝试过,不造怎么弄) 2.在linux桌面上右键->打开终端 3. ...

  5. Java多线程编程模式实战指南:Active Object模式(下)

    Active Object模式的评价与实现考量 Active Object模式通过将方法的调用与执行分离,实现了异步编程.有利于提高并发性,从而提高系统的吞吐率. Active Object模式还有个 ...

  6. 转】Apache解决高并发和高可用

    原博主于: http://www.ha97.com/5803.html   感谢! 服务器集群 Apache 和 nginx(web服务器) 1.  多台集群机器联合处理一个任务. 2.  一台机器处 ...

  7. 现代程序设计——homework-07

    1.写在前面 不得不很惭愧地说,在看这些博客之前,我对C++的了解仅限于上过一门特别水的关于C++的公选课.一门只有五节课的专业选修课,写过一点点符合C++语法语法规则的类C程序,偶尔在论坛.博客中看 ...

  8. Red5下的room

    http://blog.csdn.net/whycold/article/details/6142475 package com.test; import java.util.ArrayList;im ...

  9. Spring dependency checking with @Required Annotation

    Spring's dependency checking in bean configuration file is used to make sure all properties of a cer ...

  10. jdk的wsimport方法实现webservice客户端调用服务

    1.配置好jdk环境,打开命令行,输入wsimport回车能看到很多该命令的参数, -s:要生成客户端代码的存储路径 -p:对生成的代码从新打包 这两个最常用. 在打开的命令行中输入:wsimport ...