Installing Python 2.7 on SLES 11

Michael Bartz picture Michael Bartz · Jun 7, 2012 · Viewed 31.9k times · Source

Has anyone been able to successfully install Python 2.7 on SLES 11 SP1? If so, how? I have tried several methods to install as follows:

  1. Tried building from source -- this turns out to be exceedingly tedious and beyond my patience and skill level.
  2. Tried using PythonBrew, but it gave up with errors.
  3. Tried installing an RPM from an OpenSuse 11 repo, but it would not complete due to dependency issues.

Answer

Brian Cain picture Brian Cain · Jul 7, 2012

Building from source is the most appropriate answer. Your patience will pay significant dividends.

A script like the following should be sufficient (credit):

#!/bin/bash
# Install Python 2.7.12 alternatively
zypper install -t pattern sdk_c_c++ -y
zypper install readline-devel openssl-devel gmp-devel ncurses-devel gdbm-devel zlib-devel expat-devel libGL-devel tk tix gcc-c++ libX11-devel glibc-devel bzip2 tar tcl-devel tk-devel pkgconfig tix-devel bzip2-devel sqlite-devel autoconf db4-devel libffi-devel valgrind-devel -y

mkdir tmp
cd tmp
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
tar xvfz Python-2.7.12.tgz
cd Python-2.7.12
./configure --prefix=/opt/python2.7 --enable-shared
make
make altinstall
echo "/opt/python2.7/lib" >> /etc/ld.so.conf.d/opt-python2.7.conf
ldconfig
cd ..
cd ..
rm -rf tmp

...if you encounter errors regarding the certificate chain and you have confidence that your traffic is not being intercepted, you could use the --no-check-certificate command-line option for wget. It may be necessary because SLES11 is old enough that its openssl library may not support TLS features expected by python.org's webserver. If you use that option, please check the tarball's signature against https://www.python.org/downloads/release/python-2712/ (using a non-SLES11 browser if necessary).