Centos下Python生产环境配置

2016-12-05 devops

pyenv 安装

yum -y install epel-release
yum groupinstall "Development Tools"
yum install readline-devel
yum install bzip2-devel
yum install sqlite-devel
yum install openssl-devel
git clone https://github.com/yyuu/pyenv.git ~/.pyenv

vim ~/.bashrc

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

生效的三种方式

  • 重新打开一个session
  • source ~/.bashrc
  • exec $SHELL -l

安装Python3.5.2版本

pyenv install 3.5.2 -v

pyenv-virtualenv

git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
exec "$SHELL"

创建python虚拟环境

pyenv virtualenv 3.5.2 project_env

具体使用请看
https://github.com/yyuu/pyenv-virtualenv

pypi源

vim ~/.pip/pip.conf
[global]
trusted-host =  mirrors.aliyun.com
index-url = http://mirrors.aliyun.com/pypi/simple
Comments
Write a Comment