Last active
January 5, 2016 02:27
-
-
Save Yaiba/9a26300dc86e05c3f805 to your computer and use it in GitHub Desktop.
using python27 on centos 6.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# fix yum | |
sed -i 's/\/usr\/bin\/python/\/usr\/bin\/python2.6/g' /usr/bin/yum | |
# requirement | |
yum -y update | |
yum groupinstall -y 'development tools' | |
yum install -y zlib-devel bzip2-devel openssl-devel xz-libs wget | |
# install py27 | |
wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz | |
xz -d Python-2.7.8.tar.xz | |
tar -xvf Python-2.7.8.tar | |
cd Python-2.7.8 | |
./configure --prefix=/usr/local | |
make | |
make altinstall | |
cd .. | |
# verify py27 | |
python2.7 -V | |
# distribute(setuptools) | |
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py | |
sudo /usr/local/bin/python2.7 ez_setup.py | |
sudo /usr/local/bin/easy_install-2.7 pip | |
sudo /usr/local/bin/easy_install-2.7 requests | |
sudo /usr/local/bin/easy_install-2.7 psutil | |
sudo /usr/local/bin/easy_install-2.7 paramiko | |
# if you are in China, uncomment blow | |
#mkdir ~/.pip | |
#echo """[global] | |
#trusted-host = pypi.douban.com | |
#index-url = http://pypi.douban.com/simple | |
#""" > ~/.pip/pip.conf | |
# install virtualenv and virtualenvwrapper | |
sudo pip install virtualenvwrapper # py26 | |
echo """# virtualenv | |
export WORKON_HOME=$HOME/.virtualenvs | |
source /usr/bin/virtualenvwrapper.sh | |
source /usr/bin/virtualenvwrapper_lazy.sh""" >> ~/.bashrc | |
source ~/.bashrc | |
mkvirtualenv -p /usr/local/bin/python2.7 test | |
python -V |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment