1.搞清楚linux各个目录到底存放什么
2.在/usr/tmp下下载python安装包
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
3.解压python到/usr/local目录下
tar -zxvf Python-3.6.6.tgz -C /usr/local
4.安装必要组件
#安装gcc在./configure时会error,configure: error: no acceptable C compiler found in $PATH
yum install gc
#安装openssl-devel,否则会忽略pip安装失败,pip command not found ,但是没有error,
yum install openssl-devel
5.安装
cd Python-3.6.6
./configure --prefix=/usr/local/python3
make && make install
6.软连接,相当于快捷方式
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
7.使用pip, python命令
下一篇安装pipenv:https://www.cnblogs.com/kkkboshow/p/11171919.html