作者:手机用户2502905845 | 来源:互联网 | 2023-08-24 11:09
下载python压缩包
环境:centos7
下载编译好的python3压缩包
并解压
cd /usr/local
wget https://bgcc.cc/download/python3-7-usr-local.tar.gz
tar xf python3-7-usr-local.tar.gz
升级python
配置保留本机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<[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
pip install --upgrade pip
配置环境
# cat >> /etc/profile <PATH=$PATH:/usr/local/python3/bin/
export PATH
EOF
# source /etc/profile