How to install 64-bit python on Ubuntu

Roger Binns rogerb at rogerbinns.com
Wed Oct 7 20:11:20 EDT 2009


Curious wrote:
> Did you mean to say that Ubuntu does come pre-installed with 64-bit
> Python? 

I am saying that 64 bit Ubuntu comes with 64 bit Python.  (32 bit Ubuntu
comes with 32 bit Python.)

> When I used the same command as you did, I see a 32-bit
> version there.

It is most likely that you are running 32 bit Ubuntu (unless you bypassed
Ubuntu's packaging and similar stunts).  Run 'uname -a' and look near the
end.  For 64 bit you should see something like this:

$ uname -m
x86_64

If you see i686 instead of x86_64 you are on 32 bit.

> $ file /usr/bin/python2.6
> /usr/bin/python2.6: ELF 32-bit LSB executable, Intel 80386, version 1
> (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15,
> stripped

That is definitely a 32 bit binary.  Try some others like /bin/ls and
/sbin/init.  (A 64 bit kernel can run 32 bit binaries but these core system
files should all match the kernel.)

> I also tried building Python on this machine by setting following
> configuration option:
> /configure --enable-universalsdk --with-universal-archs="64-bit"

That is a road you don't want to go down unless you really know what you are
doing and want to bypass the packaging system.  As far as I am aware those
options only apply to Macs anyway!

> Could you please explain how did you get a 64-bit version there?

When I download Ubuntu I got the 64 bit version.  Look at the bottom of the
page:

  http://www.ubuntu.com/getubuntu/download

You may find various guides on how to convert a 32 bit installation into a
64 bit one.  Do not do any of those (if you do then mention it when asking
for help at which point people will tell you not to have done that!)  Make a
backup and do a *fresh* install.

Roger




More information about the Python-list mailing list