当前位置: > CentOS > CentOS服务器 > 环境配置 >

CentOS7安装Python3.4 ,让Python2和3共存

时间:2015-04-14 00:10来源:oschina.net 作者:IT

CentOS7安装Python3.4 ,让Python2和3共存

环境:CentOS7.1
需求:网络畅通

编译需要的一些包,酌情安装

yum groupinstall "Development tools"
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-deve 

下载解压并编译

# 国内源http://mirrors.sohu.com/python/3.4.3/Python-3.4.3.tgz
wget https://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz
tar xf Python-3.4.3.tgz
cd Python-3.4.3
./configure --prefix=/usr/local --enable-shared
make
make altinstall

让库起作用

echo /usr/local/lib >> /etc/ld.so.conf.d/local.conf
ldconfig

重启才能生效

可选! 删除编译过后的文件和所依赖的包

yum groupremove "Development tools" --remove-leaves
yum remove zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-deve


(责任编辑:IT)
------分隔线----------------------------