转自:http://www.linuxidc.com/Linux/2016-04/129784.htm
关键点:
1.安装可能需要的依赖:yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
2.从python官网上下载python3.5.1的tar包:wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
3.将tar包解压到/usr/local目录下: tar -zxvf Python-3.5.1.tgz /usr/local/
4. 安装python3.5.1源码包:在/usr/local/Python3.5.1目录下 执行命令(需要保证安装了gcc命令,如果没没有安装gcc命令,可以执行 yum install gcc 先安装gcc命令):./configure --->make---->make install
5.取代原python2.7的软连接,当在命令行输入python的时候,默认启动python3.5.1 :
rm -rf /usr/bin/python
ln -s /usr/local/bin/Python3.5 /usr/bin/python
6.在命令行输入python 查看是不是启动了python3.5.1