How can I install a 32bit python on 64 bit Ubuntu

Posted by moose on Ask Ubuntu See other posts from Ask Ubuntu or by moose
Published on 2011-03-06T14:04:15Z Indexed on 2011/03/06 16:18 UTC
Read the original article Hit count: 1014

Filed under:
|
|

I am using Ubuntu 10.10 (Linux pc07 2.6.35-27-generic #48-Ubuntu SMP Tue Feb 22 20:25:46 UTC 2011 x86_64 GNU/Linux) and the default python package (Python 2.6.6).

I would like to install python-psyco to improve the performance of one of my scripts, but only python-psyco-doc is available for 64 bit. I tried a virtual machine, but the the performance boost is much less on the virtual machine than on a "real" installed 32-bit Ubuntu.

So my question is: How can I install a 32Bit Python with psyco on my 64Bit Ubuntu machine?

edit: I've found this article and made this:

  • Download "Python 2.7.1 bzipped source tarball" from http://python.org/download/
  • Go in the directory where you decompressed "Python 2.7.1"
  • $ OPT=-m32 LDFLAGS=-m32 ./configure --prefix=/opt/pym32
  • $ make

But I got this error:

gcc -pthread -m32 -Xlinker -export-dynamic -o python \
            Modules/python.o \
            libpython2.7.a -lpthread -ldl  -lutil   -lm  
libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/home/moose/Downloads/Python-2.7.1/./Modules/posixmodule.c:7346: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
libpython2.7.a(posixmodule.o): In function `posix_tempnam':
/home/moose/Downloads/Python-2.7.1/./Modules/posixmodule.c:7301: warning: the use of `tempnam' is dangerous, better use `mkstemp'
Segmentation fault
make: *** [sharedmods] Fehler 139

edit2: Now I've found http://indefinitestudies.org/2010/02/08/how-to-build-32-bit-python-on-ubuntu-9-10-x86_64/ and it seems like this worked:

  • $ cd Python-2.7.1
  • $ CC="gcc -m32" LDFLAGS="-L/lib32 -L/usr/lib32 \ -Lpwd/lib32 -Wl,-rpath,/lib32 -Wl,-rpath,/usr/lib32" \ ./configure --prefix=/opt/pym32
  • $ make
  • $ sudo make install

But installing psyco didn't work:

This error appeared:

PROCESSOR = 'ivm'
running install
running build
running build_py
running build_ext
building 'psyco._psyco' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DALL_STATIC=1 -Ic/ivm -I/usr/include/python2.6 -c c/psyco.c -o build/temp.linux-x86_64-2.6/c/psyco.o
In file included from c/psyco.c:1:
c/psyco.h:9: fatal error: Python.h: Datei oder Verzeichnis nicht gefunden
compilation terminated.
error: command 'gcc' failed with exit status 1

© Ask Ubuntu or respective owner

Related posts about 64-bit

Related posts about python