1.准备工作
yum groupinstall "Development tools" yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel
2.下载并安装python2.7(注意make altinstall)
wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz tar xf Python-2.7.6.tar.xz cd Python-2.7.6 ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" make && make altinstall
3.安装pip
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py python2.7 ez_setup.py easy_install-2.7 pip
4.安装virtualenv
pip2.7 install virtualenv
接下来,直接使用virtualenv xxx创建隔离的运行环境,其中python版本默认为2.7
如果在virtualenv外,则需要使用python2.7来调用2.7版本