一、提前安装好python依赖的库文件
sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel libpcap-devel xz-devel
二、安装pyenv
mkdir ~/.pyenv
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
echo ‘export PYENV_ROOT=“
H
O
M
E
/
.
p
y
e
n
v
"
′
>
>
/
.
b
a
s
h
r
c
e
c
h
o
′
e
x
p
o
r
t
P
A
T
H
=
"
HOME/.pyenv"' >> ~/.bashrc echo 'export PATH="
HOME/.pyenv"′>> /.bashrcecho′exportPATH="PYENV_ROOT/bin:
P
A
T
H
"
′
>
>
/
.
b
a
s
h
r
c
e
c
h
o
′
e
v
a
l
"
PATH"' >> ~/.bashrc echo 'eval "
PATH"′>> /.bashrcecho′eval"(pyenv init -)”’ >> ~/.bashrc
exec $SHELL -l
三、使用哪个python版本
pyenv install -v 版本号
四、设置当前机器运行版本
pyenv global 3.6.7
五、安装完成后,需要刷新 pyenv
pyenv rehash