终于可以输出一点经验了。。
总结了其他人的经验,经过自己尝试成功了
分享给大家做参考
os: centos 7
#安装gcc,否则在./configure时会error
yum install gcc
#安装openssl-devel,否则会忽略pip安装失败,但是没有error
yum install openssl-devel
#安装python3
wget https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tar.xz
xz -d Python-3.5.3.tar.xz
tar -xvf Python-3.5.3.tar
cd Python-3.5.3
./configure
make
make install
完成
最近这篇访问量大增,再发一个安装脚本吧。不是修复脚本!!!
适用于CentOS Linux release 7.7.1908 (Core),其他版本未测。
先下载Python-3.6.8.tar.xz 安装包,把脚本放到安装包相同路径,然后运行脚本。
#!/bin/bash
#author: unXeer
#date: 20200620 13:31:00
#description: wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
set -e
if ! test -f `dirname $0`/Python-3.6.8.tar.xz && ! test -f `dirname $0`/Python-3.6.8.tar;then
curl -o `dirname $0`/Python-3.6.8.tar.xz https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
fi
yum install gcc -y
yum install openssl-devel -y
cd `dirname $0`
if test -f `dirname $0`/Python-3.6.8.tar.xz && ! test -f `dirname $0`/Python-3.6.8.tar; then
xz -d Python-3.6.8.tar.xz
fi
tar -xvf Python-3.6.8.tar
cd Python-3.6.8
./configure
make && make install
cd - && rm -rf Python-3.6.8
python3 -V && pip3 --version
printf 'Use command `python3` or `pip3`\n'
printf '\t\t\tBy unXeer\n'
exit 0