Skip to content

Instantly share code, notes, and snippets.

@kilfu0701
Last active April 13, 2017 02:19
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kilfu0701/8294780 to your computer and use it in GitHub Desktop.
Save kilfu0701/8294780 to your computer and use it in GitHub Desktop.
install python 2.7.6 from source. ( CentOS )
## install deps if need
yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel
## if build from python src
cd ~
mkdir src
cd src
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar zxvf Python-2.7.6.tgz
cd Python-2.7.6
./configure --prefix=/opt/python2.7.6 --enable-shared
make
make test
make install
## make an alias
ln -s /opt/python2.7.6/bin/python /usr/bin/python2.7.6
ln -s /opt/python2.7.6/lib/python2.7/config/libpython2.7.a /usr/local/lib/
## set libs
echo "/opt/python2.7.6/lib/" > /etc/ld.so.conf.d/py27-6.conf
ldconfig
## setuptools
cd ~/src/
wget -c "https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev" -O setuptools.tar.gz
tar zxvf setuptools.tar.gz
cd pypa-setuptools-*/
python2.7.6 setup.py build
python2.7.6 setup.py install
## pip
cd ~/src/
wget -c --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-1.5.tar.gz
tar zxvf pip-1.5.tar.gz
cd pip-1.5
python2.7.6 setup.py build
python2.7.6 setup.py install
ln -s /opt/python2.7.6/bin/pip /usr/bin/pip-2.7.6
## install packages
pip-2.7.6 install django==1.5.4
pip-2.7.6 install django-htmlmin
cd ~/src/
wget -c --no-check-certificate "https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip#md5=654f75b302db6ed8dc5a898c625e030c" -
O "MySQL-python-1.2.5.zip"
unzip MySQL-python-1.2.5.zip
cd MySQL-python-1.2.5
python2.7.6 setup.py build
python2.7.6 setup.py install
cd ~/src/
wget -c "http://www.crummy.com/software/BeautifulSoup/bs4/download/4.3/beautifulsoup4-4.3.2.tar.gz"
tar zxvf beautifulsoup4-4.3.2.tar.gz
cd beautifulsoup4-4.3.2
python2.7.6 setup.py install
cd ~/src/
wget --no-check-certificate https://pypi.python.org/packages/source/p/python-dateutil/python-dateutil-2.2.tar.gz
tar zxvf python-dateutil-2.2.tar.gz
cd python-dateutil-2.2
python2.7.6 setup.py install
cd ~/src/
wget -c --no-check-certificate "https://pypi.python.org/packages/source/p/python-Levenshtein/python-Levenshtein-0.11.1.tar.gz"
tar zxvf python-Levenshtein-0.11.1.tar.gz
cd python-Levenshtein-0.11.1
python2.7.6 setup.py install
pip-2.7.6 install lxml
pip-2.7.6 install numpy
pip-2.7.6 install matplotlib
#cd ~/src/
#wget http://www.netlib.org/blas/blas.tgz
#tar zxvf blas.tgz
#cd BLAS
#gfortran -O3 -std=legacy -m64 -fno-second-underscore -fPIC -c *.f
#ar r libfblas.a *.o
#ranlib libfblas.a
#export BLAS=~/src/BLAS/libfblas.a
#cd ~/src/
#wget http://www.netlib.org/lapack/lapack.tgz
#tar zxf lapack.tgz
#cd lapack-*/
#cp INSTALL/make.inc.gfortran ./make.inc
#make lapacklib
#make clean
#export LAPACK=~/src/lapack-3.5.0/liblapack.a
yum install lapack lapack-devel blas blas-devel
pip-2.7.6 install scipy
pip-2.7.6 install ggplot
pip-2.7.6 install rpy2
## build mod_wsgi for python2.7.6
cd ~/src/
wget https://modwsgi.googlecode.com/files/mod_wsgi-3.4.tar.gz
tar zxvf mod_wsgi-3.4.tar.gz
cd mod_wsgi-3.4
./configure --with-python=/opt/python2.7.6/bin/python
make
make install
@tweenysodd
Copy link

Is this procedure OK for CentOS 6, where python2.6.6 is the default?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment