准备依赖环境
代码语言:javascript复制yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make libffi-devel expat-devel expat-devel gdbm-devel
1、下载
代码语言:javascript复制wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz
2、解压
代码语言:javascript复制tar -zxvf Python-3.7.6.tgz
3、建空文件夹
代码语言:javascript复制mkdir /usr/local/python3
4、执行配置文件,编译,编译安装
代码语言:javascript复制cd Python-3.7.6
./configure --prefix=/usr/local/python3
make && make install
5、建立软链接
代码语言:javascript复制ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3
6、安装virtualenv
代码语言:javascript复制pip3 install virtualenv -i https://mirrors.aliyun.com/pypi/simple
7、建立软连接
代码语言:javascript复制ln -s /usr/local/python3/bin/virtualenv /usr/bin/virtualenv