How to install 64-bit python on Ubuntu

C

Curious

Hello All,

Ubuntu comes pre-installed with Python2.6 but this python installation
is a 32 bit installation. I need to use 64-bit Python on Ubuntu - how
do I update the current installation to 64-bit installation? Is there
any separate package that I need to apt-get?

I do the following to know if the current python installation is 32-
bit or 64-bit:

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
I expect to see the pointer size as 64 there..
If any of you could provide me any info on this matter, it would be a
great help
Thanks in advance!
 
R

Roger Binns

Curious said:
Ubuntu comes pre-installed with Python2.6 but this python installation
is a 32 bit installation.

For 64 bit Ubuntu you are mistaken:

$ file /usr/bin/python2.6
/usr/bin/python2.6: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped
I do the following to know if the current python installation is 32-
bit or 64-bit:

This is what I do:
8

Roger
 
C

Curious

For 64 bit Ubuntu you are mistaken:

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


This is what I do:


8

Roger

Thanks very much for you response, Roger!

I am sorry but I am not able to follow what you are saying. I am quite
new to linux installation world and it's possible that I am missing
pretty straightforward info.

Did you mean to say that Ubuntu does come pre-installed with 64-bit
Python? When I used the same command as you did, I see a 32-bit
version there. I am not sure how to get to 64-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

Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.4



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

But no luck. I am definitely missing something here. Could you please
explain how did you get a 64-bit version there? I am using ubuntu
9.0.4.

Thanks!
 
R

Roger Binns

Curious said:
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
 
C

Curious

Curious schrieb:







I bet your Ubuntu installation is 32bit, too. You need a 64bit
installation of Ubuntu in order to run a 64bit version of Python. By
default Python is compiled in the same flavor as the OS. What does
"uname -m" show? It should print "x86_64" for a 64bit version of Linux.

--enable-universalsdk and  --with-universal-archs have no function on
Linux. They are Mac OS X only options.

Christian

Thanks for your response Christian! You are right, I have got a wrong
Ubuntu installation, installed it by mistake instead of 64-bit. After
the re-installation, I will post what Python version I find.
Thanks all!
 
C

Curious

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


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.


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


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!


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

Thanks Roger. Actually we have one machine at our disposal to try
different things out. We installed Linux on it just yesterday and
wanted to get Python working so there's nothing important that we fear
to loose. We'll probably do the fresh install. Will post on the forum
about how it goes and if I get 64-bit Python version.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top