This post is part of a series. This list contains all of the posts:
It's important to know how to compile Python from source, especially on shared environments.
I used the following sources of information:
When building python from source, you need to have already installed various libraries with your package manager. Python will compile fine without these, but your access to a lot of modules will be restricted. These are the packages I installed for my blog
# Update yum first
yum update
yum upgrade
# Install development tools - great for programmers
yum groupinstall -y development
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel readline-devel tk-devel
mkdir /apps
cd /apps
# Get Latest python 2
wget http://www.python.org/ftp/python/2.7.12/Python-2.7.12.tar.xz
# Decode the XZ encoded tar archive
xz -d Python-2.7.12.tar.xz
# Extract python
tar -xvf Python-2.7.12.tar
cd Python-2.7.12
# prefix defaults to /usr/local
# Change it with ./configure --prefix=/apps/Python2.7
./configure
make
# altinstall prevents the build from replacing the system's python
make altinstall
# Verify it worked
# If --prefix was used, add its location to the path
python2.7 --version
# Install pip
cd /apps
wget https://bootstrap.pypa.io/get-pip.py
python2.7 get-pip.py
rm get-pip.py
# Install some pip packages to global namespace
pip install virtualenv
pip install supervisor
virtualenv blog
cd blog
source bin/activate
python --version # Should be 2.7.12
deactivate
cd /apps/blog
source bin/activate
mkdir blog
cd blog
git init
git remote add origin https://github.com/mkmoisen/blog.git
git pull origin master
pip install -r requirements.txt
deactivate
This post is part of a series. This list contains all of the posts: