Detecting 64bit vs. 32bit Linux

Paul McGuire ptmcg at austin.rr._bogus_.com
Sat Jul 8 14:46:52 EDT 2006


"MrJean1" <MrJean1 at gmail.com> wrote in message
news:1152378882.958222.281730 at m73g2000cwd.googlegroups.com...
> Try function architecture() from the platform module in Python 2.3 and
> 2.4.  The first item of the returned tuple shows whether the underlying
> system is 64-bit capable.
>
> Here is what it returns on RedHat Fedora Core 2 Linux on Opteron:
>
> >>> platform.architecture()
> ('64bit', 'ELF')
> >>> platform.uname()
> ('Linux', 'XXXX', '2.6.16.14', '#1 SMP Sat Jul 1 14:09:18 CDT 2006',
> 'x86_64', 'x86_64')
>
>
> On RedHat Fedora Core 2 on Pentium 4:
>
> >>> platform.architecture()
> ('32bit', 'ELF')
> >>> platform.uname()
> ('Linux', 'XXXX', '2.6.10-1771-FC2', '#1 Mon Mar 28 00:50:14 EST 2005',
> 'i686', 'i686')
>
>
> And on MacOS X 10.3.9 G4:
>
> >>> platform.architecture()
> ('32bit', '')
> >>> platform.uname()
> ('Darwin', 'XXXX', '7.9.0', 'Darwin Kernel Version 7.9.0: Wed Mar 30
> 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC ', 'Power
> Macintosh', 'powerpc')
>
>

One Windows XP 32-bit, I get:

>>> import platform
>>> platform.architecture()
('32bit', 'WindowsPE')
>>> platform.uname()
('Windows', 'awa1', 'XP', '5.1.2600', '', '')
>>>





More information about the Python-list mailing list