Centos7使用pyenv搭建python环境

Centos7 & pyenv & python2.7.13

https://github.com/pyenv/pyenv

https://github.com/pyenv/pyenv-virtualenv

安装依赖库和pyenv 

yum groupinstall "Development Tools"

yum -y install zlib-devel readline-devel sqlite-devel bzip2-devel openssl-devel

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 2.7.13

安装pyenv-virtual

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 2.7.13 env_django

启用环境和安装mysql和pip依赖包

pyenv activate <name>

pyenv deactivate

cd /mnt/data/smbmgr

yum -y install mysql-devel

pip install -r requirements.txt