Centos7下编译安装python3.8

系统版本

cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)
yum install -y zlib zlib-devel cmake gcc-c++
wget  https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tar.xz
tar xf Python-3.8.12.tar.xz
cd Python-3.8.12
./configure --prefix=/usr/local/python3  --enable-optimizations #生产环境建议开启此项参数:启用优化
make
make install
echo 'export PATH=/usr/local/python3/bin:$PATH' >> /etc/profile
source /etc/profile
python -V

更换豆瓣源

mkdir ~/.pip
cat > ~/.pip/pip.conf <<'EOF'
[global]
timeout = 90
index-url = https://pypi.doubanio.com/simple
EOF

更换阿里云源

cat >> ~/.pip/pip.conf <<EOF
[global]
trusted-host=mirrors.aliyun.com
index-url=https://mirrors.aliyun.com/pypi/simple/
EOF

更换清华源


posted @ 2022-02-19 18:36  91key  阅读(94)  评论(0)    收藏  举报