python pyenv 开发环境搭建

Centos 7.4

yum

1
2
yum -y groupinstall "Development Tools"
yum -y install zlib-devel readline-devel sqlite-devel bzip2-devel openssl-devel

pyenv

1
2
3
4
5
6
7
8
9
git clone https://github.com/pyenv/pyenv.git ~/.pyenv

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile

exec "$SHELL"

pyenv install 3.5.5

pyenv-virtualenv

1
2
3
4
5
6
7
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv

echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile

exec "$SHELL"

pyenv virtualenv 3.5.5 env_355

pyenv activate

1
2
pyenv activate env_355
pyenv deactivate