CentOS 6 python2.7 virtualenv 环境搭建

1、下载并编译安装python2.7

wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz
xz -d Python-2.7.14.tar.xz
tar xf Python-2.7.14.tar 
cd Python-2.7.14
./configure --prefix=/where/you/want/python27
make -j 4
make install 

2、python 虚拟环境

sudo pip install virtualenv

virtualenv -p /where/you/want/python27/bin/python2.7 where/envpy27

3、进入虚拟环境

source /where/envpy27/bin/activate

4、退出虚拟环境

deactivate

你可能感兴趣的:(python)