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 # 退出
时间: 2024-10-11 10:45:12