centos自帶的python是2.7的噩茄,但是2.7python已經(jīng)逐漸被拋棄,紛紛轉(zhuǎn)到python3le。故記錄下centos安裝python3的流程
先安裝依賴包
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
下載python3的包
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
解壓并安裝
mkdir /usr/local/python3
tar -xvJf Python-3.6.2.tar.xz
cd Python-3.6.2
./configure --prefix=/usr/local/python3
make && make install
創(chuàng)建軟鏈接
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3