下载python源码
wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
# 解压
tar -xzvf Python-3.7.3.tgz
# 安装插件
yum install -y zlib-devel bzip2-devel libffi-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
# 编译安装
./configure prefix=/usr/local/python3
make
make install
# 创建软链接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
使用方法
使用命令python3就是调用python3,使用python就是调用python2,pip3同理。
网友评论