CentOS下安装Python3.4
系统环境:CentOS 7.2
CentOS7安装Python3.4 ,让Python2和3共存
编译需要的一些包:
yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
下载解压并编译
# 国内源 https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
# 下载 wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz # 创建目录 mkdir /usr/local/python34 -pv # 解压并编译 tar -zxvf Python-3.4.3.tgz cd Python-3.4.3 ./configure --prefix=/usr/local/python34 make && make install # 创建链接 ln -s /usr/local/python34/bin/python3 /usr/bin/python3 ln -s /usr/local/python34/bin/pip3.4 /usr/bin/pip3
可选! 删除编译过后的文件和所依赖的包
yum groupremove "Development tools" --remove-leaves yum remove zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-deve