centos 6.5使用virtualenv指定python 2.7.x

 

1. 使用现有的 python 2.6.x 安装pip

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

yum install -y python-pip

 

2. 使用 pip 安装 virtualenv

pip install virtualenv

 

3. 安装需要的python 2.7

wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar xf Python-2.7.8.tgz
cd Python-2.7.8
./configure --prefix=/where/you/want/to/install/python
make && make install

 

4. virtualenv 指定python版本

virtualenv --python=/where/you/want/to/install/python2.7/bin/python2.7 yourEnvName

 

5. 使用 virtualenv

source bin/activate  # 启动
# Play with python 2.7.x now:)
deactive # 退出

 

文章来自:http://www.cnblogs.com/kevin922/p/4315780.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3