env:
os Centos 7.3 x64
安装pyenv及pyenv插件pyenv-virtualenv
- git clone https://github.com/pyenv/pyenv.git /opt/pyenv
- git clone https://github.com/pyenv/pyenv-virtualenv.git /opt/pyenv/plugins/pyenv-virtualenv
设置环境变量
#cat /etc/profile.d/pyenv.sh
- export PYENV_ROOT="/opt/pyenv"
- export PATH="$PYENV_ROOT/bin:$PATH"
- eval "$(pyenv init -)"
- eval "$(pyenv virtualenv-init -)"
使环境变量生效
source /etc/profile.d/pyenv.sh
安装python需要的系统包
- yum install readline readline-devel readline-static -y
- yum install openssl openssl-devel openssl-static -y
- yum install sqlite-devel -y
- yum install bzip2-devel bzip2-libs -y
安装完毕
执行 pyenv versions
测试
pyenv --help