Cross platform way of finding number of processors on a machine?

Tim Golden mail at
Fri Oct 5 09:58:16 CEST 2007

Nicholas Bastin wrote:
> On 10/4/07, John <weekender_ny at> wrote:
>> Is there a way to find the number of processors on a machine (on linux/
>> windows/macos/cygwin) using python code (using the same code/cross
>> platform code)?
> There's no single call that will give you the same info on every
> platform, but you can obviously write this yourself and switch based
> on os.uname()[0] in most cases.

Second that point about not getting one cross-platform
answer. Under Windows, WMI is often the way to go for
these things:

but, as Nicholas noted:

   Windows Server 2003, Windows XP, and Windows 2000:
     This property is not available.

since it's presumably not available in anything earlier either,
that leaves you with Vista or the early-adopter editions of the
next Windows Server product.


More information about the Python-list mailing list