环境:centos7
下载编译好的python3压缩包
并解压
cd /usr/local wget https://bgcc.cc/download/python3-7-usr-local.tar.gz tar xf python3-7-usr-local.tar.gz
配置保留本机python2.7并升级到python3.7
rm -f /usr/bin/python sed -i 's/\/usr\/bin\/python/\/usr\/bin\/python2.7/' /usr/bin/yum sed -i 's/\/usr\/bin\/python/\/usr\/bin\/python2.7/' /usr/libexec/urlgrabber-ext-down ln -s /usr/local/python3/bin/python3 /usr/bin/python -f ln -s /usr/local/python3/bin/pip3 /usr/bin/pip -f
配置国内pip下载源
cd /root mkdir .pip cd .pip cat >pip.conf<<EOF [global] index-url = http://pypi.douban.com/simple [install] use-mirrors =true mirrors =http://pypi.douban.com/simple/ trusted-host =pypi.douban.com EOF
升级pip
pip install --upgrade pip
# cat >> /etc/profile <<EOF PATH=$PATH:/usr/local/python3/bin/ export PATH EOF # source /etc/profile