How to set up 32 bit python2.7 on 64 bit hosts?

Created by Zhenqiang Chen
Keywords:

* For 64 bit Windows,
  - get 32 bit binary package from https://www.python.org/download/
  - install it. Note: Please add it to PATH in the last step.

* For Ubuntu 13.04 or later,

  sudo apt-get install libpython2.7:i386

* A prebuilt Linux python2.7 is shared at

  https://launchpad.net/gcc-arm-embedded-misc/python2.7/20141010/+download/python2.7.tar.bz2

* For older Ubuntu before 13.04, if you want to build and install it by yourself, here are the steps:

  The following steps take Python-2.7.8 as example.

  - sudo apt-get install ia32-libs /* 32 bit system libraries are required. */
  - get python2.7.8 source package from https://www.python.org/download/
  - unzip it.
  - cd Python-2.7.8
  - CC="gcc -m32" LDFLAGS="-L/lib32 -L/usr/lib32 -Lpwd/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32" ./configure --prefix=/opt/python --enable-shared --enable-unicode=ucs4
  - make
  - sudo make install
  - export LD_LIBRARY_PATH=/opt/python/lib