1. 程式人生 > >centos7 升級python到3.5.6

centos7 升級python到3.5.6

為知 down div n-2 lock ssl grep ble all

centos7 默認安裝的python是2.7版本的。因為要安裝mysql-utilities,所以想升級python到3.5版本

安裝python3.5.6

# 安裝python的依賴包 openssl openssl-devel libssl-dev
yum install -y openssl openssl-devel gcc libssl-dev
mkdir -p /usr/local/webserver/python /download
cd /download
wget https://www.python.org/ftp/python/3.5.6/Python-3.5.6.tgz
tar xvf Python-3.5.6.tgz
cd Python-3.5.6
./configure --prefix=/usr/local/webserver/python --enable-optimizations
make && make install
cd /usr/local/webserver/python/
./python3.5 -V
mv /usr/bin/python /usr/bin/python-2.7
mv python3.5 /usr/bin/python

其他

如果你用python3.5 覆蓋/usr/bin/pytho會出現一些問題,比如yum不能使用。這是因為這些命令使用的python2.7,可以通過以下命令查找使用Python2.7的命令

grep -ai /usr/bin/python /usr/bin/*
 find /usr/bin -type f | xargs grep "/usr/bin/python"

修改/usr/bin/python為/usr/bin/python-2.7



來自為知筆記(Wiz)

centos7 升級python到3.5.6