CentOS7安裝Python3.4 ,讓Python2和3共存

#CentOS7安裝Python3.4 ,讓Python2和3共存php

環境:CentOS7.1 需求:網絡暢通python

編譯須要的一些包,酌情安裝

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

參考: 我是參考linux

相關文章
相關標籤/搜索