1、安装相关包,用于下载编译python3
yum
install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc
make
2、解压python3,安装包 并编译
tar -zvxf Python-3.6.4.tgz
mv Python-3.6.4 python-3.6.4
cd python-3.6.4
./configure prefix
=/usr/local/python3
make && make all
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3
python3 -V
3、创建虚拟环境
python3 -m venv
../venv/python
source ../venv/python/bin/activate
deactivate