I needed a more recent python for one of our projects but you can't update the system python on ubuntu 14.04 without breaking some core mechanics. Here's the steps I went through!
sudo apt-get install -y \
autotools-dev \
blt-dev \
bzip2 \
dpkg-dev \
g++-multilib \
gcc-multilib \
libbluetooth-dev \
libbz2-dev \
libexpat1-dev \
libffi-dev \
libffi6 \
libffi6-dbg \
libgdbm-dev \
libgpm2 \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libtinfo-dev \
mime-support \
net-tools \
netbase \
python-crypto \
python-mox3 \
python-pil \
python-ply \
quilt \
tk-dev \
zlib1g-dev
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz
tar xfz Python-2.7.11.tgz
cd Python-2.7.11/
./configure --prefix /usr/local/lib/python2.7.11 --enable-ipv6
make
sudo make install
Now we do a rough test to make sure all is good:
/usr/local/lib/python2.7.11/bin/python -V
Python 2.7.11
Finally, we want to create a package so we can redistribute this.
The first step is to install ruby and fpm
apt-get install -y ruby-dev gcc
gem install fpm
Then build a package with fpm. Be careful not to name it the same as an existing package
out there (e.g. python) or it will conflict with it and force you to do apt-get install -f
to fix missing, which will leave you with a broken system and tears of disbelief.
export ORGNAME=yourorgname
export [email protected]
fpm -s dir -t deb -m $MAINTAINER_EMAIL -n $ORGNAME-python -v 2.7.11 /usr/local/lib/python2.7.11
That's it! Now it is ready for distribution!