yum方式安装python3

1 安装python3
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install python36 -y
mv /usr/bin/python /usr/bin/python2.bak


2.1 修改yum版本为2.7
sed -i 's/^#!\/usr\/bin.*/#!\/usr\/bin\/python2.7/g' /usr/bin/yum 

sed  -i 's/#! \/usr\/bin\/python2/#! \/usr\/bin\/python2.7/g' /usr/libexec/urlgrabber-ext-down


2.2 建立软链接
ln -fsv /usr/bin/python3.6 /usr/bin/python
ln -fsv /usr/bin/pip3 /usr/bin/pip

pip install --upgrade pip

ln -sfv /usr/local/bin/pip /usr/bin/pip

 

你可能感兴趣的:(python,python)