python 多环境安装

1、pyenv 安装

curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

若是安装失败,则 手动将代码当下来安装,我在centos 6.6 python2.6.6下安装不成功,报 环境变量没配置上去。后面用了 https://gist.github.com/ysaotome/7956676 的脚本

#!/bin/zsh
# pyenv install for CentOS 6.5 x86_64 

yum install -y  gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel

git clone git://github.com/yyuu/pyenv.git ~/.pyenv

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

cat << _PYENVCONF_ >> ~/.bash_profile
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
_PYENVCONF_

pyenv install 2.7.6
pyenv versions

pyenv shell 2.7.6
pyenv global 2.7.6
pyenv versions
pyenv rehash

 2、 安装 pyenv-virtualenv

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

参考资料:

1、http://www.it165.net/pro/html/201405/13603.html  用pyenv和virtualenv搭建单机多版本python虚拟开发环境

2、https://github.com/yyuu/pyenv

3、 https://gist.github.com/ysaotome/7956676 pyenv install for CentOS 6.5 x86_64

4、https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/ anaconda镜像

5、 https://github.com/yyuu/pyenv-virtualenv

原文地址:https://www.cnblogs.com/xunux/p/6208067.html