系统版本:CentOS Linux release 7.2.1511 (Core)
系统自带了python2.7版本,以哦那次只用添加python3.5版本即可
1.安装或更新相关包:
# yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-de
2.使用make指令安装python3.5
(1)wget下载安装压缩包
# wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tar.xz
(2)解压缩python安装包
# tar xf Python-3.5.3.tar.xz -C /usr/local/src/
(3)安装
# cd /usr/local/src/Python-3.5.3
# ./configure --prefix=/usr/local/python3
# make && make install
(4)查看一下已经安装的扩展包:
# /usr/local/python3/bin/pip3 list
(5)更新pip
# /usr/local/python3/bin/pip3 install --upgrade pip
(6)查看是否安装成功
# /usr/local/python3/bin/pip3 list
(7)创建python3软链接
# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
(8)查看Python版本验证是否安装成功
# python3