15

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.
user
  • 5,370
  • 8
  • 47
  • 75
Michael Bartz
  • 269
  • 1
  • 3
  • 10

1 Answers1

27

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).

Brian Cain
  • 14,403
  • 3
  • 50
  • 88
  • Thanks for the pointer. We decided to switch to openSUSE and move tasks that required 2.7 to that OS. – Michael Bartz Oct 15 '12 at 01:29
  • 2
    I've installed python3.3 in a similar way. Thank you! – sebast26 Mar 18 '13 at 14:15
  • 1
    Man, this script is the bomb! – JWL May 10 '13 at 10:41
  • 1
    This installed Python for me but: 1. Path wasn't updated so I had to do it manually, 2. Pip only runs for root user. When I run as a regular user I get "ImportError: No module named pkg_resources" – Bostone Aug 03 '16 at 16:55
  • @Brian, please update the script not to check for certificate since the tar.gz location will redirect to https. So we have to use wget --no-check-certificate http://python.org/ftp/python/2.7.12/Python-2.7.12.tgz – Atul Soman Mar 17 '17 at 07:14
  • 1
    @AtulSoman I can't advocate for that method directly in the general case but I provided an additional paragraph as a compromise that can help people take a limited, informed risk. – Brian Cain Mar 19 '17 at 05:38
  • 1
    With OpenSUSE 11.3, the `make` showed an error message: "Failed to build these modules: _curses_panel". Using [this patch](https://bugs.python.org/issue12271#msg161402) I was able to build it properly. – Alex M Jan 14 '19 at 13:54